Unable to remove old CSEvent
I have a CSEvent which I am unable to get rid - nor can I overwrite it with new data.
JS
(function(){
'use strict';
var csInterface = new CSInterface();
var event = new CSEvent("com.adobe.PhotoshopRegisterEvent", "APPLICATION");
event.extensionId = "com.example.psevents"; // Optional param
event.data = "1936483188"; // charIDToTypeID("slct") - which is "select"
csInterface.dispatchEvent(event);
function init(){
// code
}
// Handler for the event listener. Fires off when a layer is selected
function PSCallback(csEvent){
alert("callback triggered");
}
init();
csInterface.addEventListener("PhotoshopCallback", PSCallback);
}());
I've tried
new CSEvent("com.adobe.PhotoshopUnRegisterEvent", "APPLICATION");
...and dispatching it, as well as using
csInterface.removeEventListener("PhotoshopCallback", PSCallback);
I am unable to remove (unregister) it completely, but once I register it again and try and add new data to this, say
event.data = "1668247673, 1885434740, 1668641824"; // copy, paste, cut
...the old event.data just comes back and the callback fires off on selections.
What's the proper way of removing old CSEvents and/or overwriting them with new data so they fire off on something else. This is getting very frustrating!
