cutie-event
Cutie extension for event module in Node. It's based on the Async Tree Pattern.
Examples
You can find examples of using this library in the test directory.
Install
npm install @cuties/event
Run test
npm test
Run build
npm run build
Usage
const {
// Needed async objects here from the table below
} = require('@cuties/event');
For more information about parameters in the async objects visit docs of Node for event module.
Async Object | Async/sync call | Parameters(default value/description) | Representation result |
---|---|---|---|
EmittedEmitter |
emitter.emit |
emitter, eventName, ...args |
emitter |
EmitterWithAdditionalListener |
emitter.addListener |
emitter, eventName, listener |
emitter |
EmitterWithAdditionalOneTimeListener |
emitter.once |
emitter, eventName, listener |
emitter |
EmitterWithAdditionalPrependedListener |
emitter.prependListener |
emitter, eventName, listener |
emitter |
EmitterWithAdditionalPrependedOneTimeListener |
emitter.prependOnceListener |
emitter, eventName, listener |
emitter |
EmitterWithMaxListeners |
emitter.setMaxListeners |
emitter, n |
emitter |
EmitterWithNewListenerEvent |
emitter.once('newListener', listener) |
emitter, listener(Event with definedBody(event, listener)) |
emitter |
EmitterWithRemoveEvent |
emitter.once('removeListener', listener) |
emitter, listener(Event with definedBody(event, listener)) |
emitter |
EmitterWithRemovedListener |
emitter.removeListener |
emitter, eventName, listener |
emitter |
EmitterWithoutAnyListeners |
emitter.removeAllListeners |
emitter, eventName |
emitter |
EventNames |
emitter.eventNames |
emitter |
(string or symbol)[] |
ListenerCount |
emitter.listenerCount |
emitter, eventName |
number |
Listeners |
emitter.listeners |
emitter, eventName |
function[] |
MaxListeners |
emitter.getMaxListeners |
emitter |
number |