async-emitter
Advanced tools
Comparing version 1.1.0 to 1.2.0
@@ -15,9 +15,11 @@ /** | ||
/** | ||
* Support both, setTimeout() and process.nextTick() | ||
* Support for setTimeout(), nextTick() and setImmediate() | ||
* @type {Function} | ||
*/ | ||
Emitter.nextTick = ( | ||
typeof process !== 'undefined' && | ||
typeof process.nextTick === 'function' | ||
) ? process.nextTick.bind( process ) : setTimeout.bind( this ) | ||
if( typeof setImmediate === 'function' ) | ||
Emitter.nextTick = setImmediate.bind( this ) | ||
else if( typeof process !== 'undefined' && process.nextTick ) | ||
Emitter.nextTick = process.nextTick.bind( process ) | ||
else | ||
Emitter.nextTick = setTimeout.bind( this ) | ||
@@ -24,0 +26,0 @@ /** |
{ | ||
"name": "async-emitter", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "Non-blocking event emitter", | ||
@@ -14,3 +14,3 @@ "license": "MIT", | ||
"name": "Jonas Hermsmeier", | ||
"email": "jhermsmeier@googlemail.com", | ||
"email": "jhermsmeier@gmail.com", | ||
"url": "http://jhermsmeier.de" | ||
@@ -25,3 +25,3 @@ }, | ||
"main": "./emitter", | ||
"main": "emitter", | ||
@@ -28,0 +28,0 @@ "repository": { |
@@ -1,2 +0,1 @@ | ||
# Emitter [![build status](https://secure.travis-ci.org/jhermsmeier/emitter.js.png)](http://travis-ci.org/jhermsmeier/emitter.js) [![NPM version](https://badge.fury.io/js/async-emitter.png)](https://npmjs.org/async-emitter) | ||
@@ -8,5 +7,5 @@ | ||
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. | ||
Looking at most implementations; that's not the case. This fixes it by running each | ||
handler with setTimeout/nextTick. | ||
## Install with [npm](https://npmjs.org/) | ||
@@ -13,0 +12,0 @@ |
7983
202
51