I agree. This demonstration of the observer pattern suits languages other than JavaScript for broadcasting events, and is a great exercise in building out the pattern for oneself. But given that JS is an event-based runtime, much of the code here essentially reimplements parts of the event loop, but doesn't have the same depth of performance optimizations as the language builtins do
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
This is good for other languages which do not have event support, why would this be better than using EventTarget api?
developer.mozilla.org/en-US/docs/W...
I agree. This demonstration of the observer pattern suits languages other than JavaScript for broadcasting events, and is a great exercise in building out the pattern for oneself. But given that JS is an event-based runtime, much of the code here essentially reimplements parts of the event loop, but doesn't have the same depth of performance optimizations as the language builtins do