Conversation
Change event dispatch process from calling event handlers in an async (setTimeout) fashion to sync calls. This fixes potential race conditions when a specific order of event processing is expected (e.g. showing and hiding loading progress spinner).
|
This needs to have proper error handling (at least by ignoring or simply logging errors). Also we might want to support both sync and async |
|
Another thing to consider when changing the current behaviour is NodeJS's EventEmitter and DOM's EventTarget. The main topics here is error propagation (i.e. does the caller get a chance to catch the error like with EventEmitter) and whether the error stops event propagation. And I think that the simplest approach will be to have dispatch and error propagation to work as follows:
The same applies to |
Change event dispatch process from calling event handlers in an async (setTimeout) fashion to sync calls. This fixes potential race conditions when a specific order of event processing is expected (e.g. showing and hiding loading progress spinner).
Why I see this as a meaningful change? The decision to process any event in async fashion shuold be done by the event subscriber, not the event dispatcher / manager. Or potentially the triggering component might want to send event asynchronously... again, that decision should not be made by the dispatcher / manager.