subscribers
A tiny library to manage lists of subscribers. Think of it as a “single event”. Use it when an event emitter is too much.
Focus has been minimal API surface and fast notification.
Installation
npm install subscribers
API
- Import the library:
var subscribers = ;
- create a list of subscribers
var list = ;// or in ES6:const subscribe notify = ;
- register subscribers:
list;; // ES6
- notify subscribers:
list;; // does not depend on `this` binding
- unsubscribe:
var unsubscribe = ;;
- Use it in other objects:
{ const notify subscribe = ; thissubscribe = subscribe; // does not depend on `this` binding }