async-emitter

Non-blocking event emitter

Emitter

A non-blocking event emitter. Non-blocking as in "if I call emitter.emit(), the emission of events to their handlers won't block".

Given the nature of "events", one would think event emission is always asynchronous. Looking at most implementations; that's not the case. This fixes it by running each handler with setTimeout/nextTick.

Install with npm

$ npm install async-emitter

Install via component

$ component install jhermsmeier/emitter.js

Install with bower

$ bower install emitter
  • function Emitter.nextTick

  • boolean Emitter.warn

  • {Emitter} emitter.on( string event, function|object handler )

  • {Emitter} emitter.once( string event, function|object handler )

  • {Boolean} emitter.emit( string event, [arg1], [arg2], [...] )

  • {Boolean} emitter.emitSync( string event, [arg1], [arg2], [...] )

  • {Emitter} emitter.removeListener( string event, function|object handler )

  • {Emitter} emitter.removeAllListeners( string [event] )

  • {Emitter} emitter.setMaxListeners( number value )

  • {Array} emitter.listeners( string event )