The Magic of Custom Event Emitters
summary
Builds a tiny custom event emitter from scratch that fits in about dozen lines and replaces Node's EventEmitter for browser use, shows queuing of emits when no listeners exist, uses arrays for applyable args, and returns listener return values. Adds two concrete features by mixing modules: wildcard listeners to observe every event and inheritance/bubbling so emits propagate up a hierarchy. Demos run live and show the wildcard and bubbling behavior working.
AI-written summary · about
chapters (7)
- 0:00Intro
- 0:31introduction
- 0:45fight complexity
- 2:14pattern recognition
- 7:33reinventing the wheel
- 9:00building an event emitter
- 14:24what are good features
related talks
18mThe Main Event: Beyond Event Listeners in JavaScript
30mWhat are Custom Elements good for?
52mEventSource: The under appreciated sibling of WebSockets
27mModern Event Handling: A Peek at the New Observable API
29mThe World Beyond Components
14mMetaprogramming Strategies for AudioWorklets
49mDesign Patterns for Modern Javascript
35mStreams: The data structure we need
