listenerjs
Hey dude! Help me out for a couple of 🍻! It will provide inspiration to keep this event subscription lib sober. You can always request for new functionaries.
Installation
npm install -D listenerjs
Usage
// someModule module definition;const event1 = ;const event2 = ; { ; ;} = onSomeEvent: callback ; return event1; onceSomeEvent: callback ; return event1; onSomeOtherEvent: event2addListener ... // Usage; // Will log "5000 after" and "10000 after"); // Will log "5000 after" only); // There is no specification for the dispatch of this event...const subscription = ); // remove subscriptionsubscription2;
API
When created an event, it will expose:
Property | Type | Parameters | Returns |
---|---|---|---|
addListener | function | function[, context] | { remove } |
dispatch | function | any | null |
once | function | function[, context] | { remove } |