Skip to content
Non-blocking event emitter
JavaScript
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
test
.npmignore
.travis.yml Updated travis.yml
README.md
bower.json
component.json
emitter.js Added logic to prevent starving the event loop
package.json

README.md

Emitter build status NPM version

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

API

Class Properties

  • function Emitter.nextTick

  • boolean Emitter.warn

Instance Methods

  • {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 )

Bitdeli Badge

Something went wrong with that request. Please try again.