Photoshop: Event listener for layer selections

I read Davide’s intro to Photoshop event listeners using the CSEvent class:
http://www.davidebarranca.com/2014/02/html-panels-tips-7-events-photoshopregisterevent-photoshopcallback/

And long story short: I got things working but I can’t seem to make an event trigger on a layer selection.
Using the charID “slct” makes the event fire when using any of the selection tools (polygon lasso, magic wand, etc) but not when selecting layers.

I found some related threads on the Adobe boards:
https://forums.adobe.com/thread/1056469
https://forums.adobe.com/thread/1247256

…but in neither case are they working with CSEvent.
If I understand this correctly, I need to provide additional parameters to my event.data before dispatching the event with csInterface.dispatchEvent(event) - but how? I don’t understand the syntax fully, and the documentation isn’t all that good.

JS


(function(){  
    'use strict';  
    var csInterface = new CSInterface();  
    var event = new CSEvent("com.adobe.PhotoshopRegisterEvent", "APPLICATION");  
    event.extensionId = "com.example.psevents";  
    event.data = "1936483188"; // charIDToTypeID("slct") - which is "select"  
    csInterface.dispatchEvent(event);  
  
    function init(){  
        // code  
    }  
  
    function PSCallback(csEvent){  
        alert("it works!");  
    }  
  
    init();  
    csInterface.addEventListener("PhotoshopCallback", PSCallback);  
}()); 

The callback here is fired off on selections, but not the ones of the type I want! It works on selections done with the marquee tool, polygon lasso, etc - and when selecting color swatches in the swatches panel. But it doesn’t fire off on layer selections (which is the one and only event I want really).

Has anyone worked with this before and is able to provide some insights? Thanks.