Forum Libraries, Components, and Plugins

EventDispatcher not dispatching newly added events from event handlers

Hi All,

I have a scenario wherein a new event listener is added to a node from an event handler that is triggered by a different event. When I try to dispatch an event for said new event listener, it does not fire. After looking through EventDispatcher's source code, I found that it does block new event listeners from being added when an event is currently dispatching and only adds them after the dispatching event handler returns. I tried force adding new event listeners by messing with the source code and now it does fire events from the event handler. Just want to know if this has some impact whatsoever. I have gone through the source code myself but I am still unsure if it is the way to go or if I have missed something.

Thanks in advance.


Sign In or Register to comment.