after-events

Event Emitter with hooks for listener returnn values

After Event Emitter

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 new needed to create.
  • 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.