Apparently, yes!
So I’m experimenting with using custom events to transfer data between dependencies of a object and the object itself. Simple right?
And it really is. I just assumed that the event sent would be asynchronous – you know, like when a ‘click’ event is sent, the event handler consumes it while JavaScript goes on its merry way.
But that’s not the case with dispatchEvent().
Any event handlers listening to an event sent by dispatchEvent() are executed first, then the code following dispatchEvent() is done.
Who’d thunk it? Well, probably just about everybody but myself.
You can read all about it in the MDN docs.
Categories: HTML Javascript
thevirtuoid
Web Tinkerer. No, not like Tinkerbell.
Creator of the game Virtuoid. Boring JavaScript. Visit us at thevirtuoid.com
Leave a Reply