How to remove an event handler?
Is there a supported way to remove an app event handler?
Sample snippet:
f = function(event){
if(event.object instanceof Document && event.type == 'loaded'){
//do stuff
}
return {handled:false};
}
app.eventHandlers.push({handler:f});
So this works great, I have a floating palette and want to force a display refresh when the user changes folders in the Bridge browser window. I tried registering the click event in the palette (where the event handler can be removed) but window events don't work right or even the same cross-platform.
My problem is that after closing the palette, the app event handler and function f() remain active and continue to fire. So every time the browser loads, f() is executed.
I tried a window.onClose() event but can't figure out how to remove the handler (beyond deleting app.eventHandlers[0] which risks deleting an event handler from a different script.) Redefining the function f() doesn't work. Adobe's documentation only talks about setting this handler and that its a simple array entry, not how to remove it. No listing of methods and nothing in Event Model Viewer.
Any ideas?
