lite-event-emitter
v1.0.2
Published
very light event emitter for node and browser
Downloads
10
Maintainers
Readme
lite-event-emitter
A very simple and light event emitter.
install
npm install lite-event-emitter
Usage
on
import {LiteEventEmitter} from 'lite-event-emitter'
let events = new LiteEventEmitter();
//add a handler
let dispose = events.on("foo", ()=>{});
//fire off an event
events.emit("foo", "bar");
//remove the handler
dispose();
once
import {LiteEventEmitter} from 'lite-event-emitter'
let events = new LiteEventEmitter();
events.once("foo", ()=>{});
events.emit("foo", "bar"); // subscription auto-disposed
Credits
"Flask" Icon courtesy of The Noun Project, by Julien Deveaux, under CC 3.0