hoki
Lightweight observer and dispatcher.
Should cover basic use cases.
No bloat.
Clean code.
Installation
It's available on npm.
npm install --save hoki
How can I use this library?
Usage
API
const register unregister observer dispatcher events = ; // Can register an event or array of events; // Can unregister an event or array of events; // Can observe for an event, and fire a callback if the event occurs
Example
const register dispatcher observer = ; // Register your event; // Observe for an event;// output in correct order:// furguson// mittens// boots ;;;
You can also add multiple observers for the same event
const register observer dispatcher = ; ; ;// output in correct order:// furguson// mittens// boots ;// output in correct order:// furguson// mittens// boots ;;;
Listen once?
const register unregister observer dispatcher = ; ; ; ;;
List all events available
const events = ; console;// [ 'cat-names' ]
Unregister
const events unregister = ; ;console;// [ ]
Tests
$ npm test
Contribution
Contributions are appreciated.
License
MIT-licensed. See LICENSE.