Event Emitter with hooks for listener returnn values
npm install after-events
Publisher/Subscriber Pattern implementation.
- .then(cb) method (see below)
- Listeners that throw errors are caught and logged to console.
- Listeners happen during their own turn.
- Listener can only listen a maximum of one time with .on()
- "removeListener" is called "off"
- No way to see if the listener is listening. (unused)
- No "addListener" alias
- No domains (unused)
- No erroring on unhandled error event. (unused)
- No maximum listener count. (unused)
- No prototype/No
newneeded to create.
after(callback: function (err: Error U undefined, res: Any U undefined, type: String, ...args: Any)): undefined
- callback is ran after every listener returns.
- First parameter to the callback is the error/rejected value of the listener, if there is one.
- Second parameter to the callback is the return value of the listener, if there is one.
- The rest of the parameters are the parameters sent to the .emit() that triggered the listener.
If you need one of the features this lacks that is marked unused, feel free to send a pull request/file an issue.