Skip to main content
100%

Do we really need an event emitter?

✓ Published0🌍 Public
Aamundo
Last edited Nov 2, 2014
Created on Nov 2, 2014

This example shows how to replace event-emitter libraries like WildEmitter with native browser APIs. It defines a Vocab model that dispatches a custom `addToVocab` event via `dispatchEvent(new CustomEvent(...))` on the global `window` object, and a VocabView that listens with `addEventListener`. The code demonstrates that `addEventListener` and `dispatchEvent` work globally without needing an emitter instance, using only vanilla JavaScript and DOM events.

AI-generated description

Similar vizzes