Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

remove extra function call from async.nextTick in node

  • Loading branch information...
commit 41f6577e47aadf63faed8f361f51f71e900ec9b2 1 parent cb1825c
Caolan McMahon caolan authored
Showing with 8 additions and 18 deletions.
  1. +8 −3 lib/async.js
  2. +0 −15 test/test-async.js
11 lib/async.js
View
@@ -79,9 +79,14 @@
//// exported async module functions ////
//// nextTick implementation with browser-compatible fallback ////
- async.nextTick = (typeof process === 'undefined' || !(process.nextTick)) ?
- function(fn) { setTimeout(fn, 0); } :
- function(fn) { process.nextTick(fn) };
+ if (typeof process === 'undefined' || !(process.nextTick)) {
+ async.nextTick = function (fn) {
+ setTimeout(fn, 0);
+ };
+ }
+ else {
+ async.nextTick = process.nextTick;
+ }
async.forEach = function (arr, iterator, callback) {
if (!arr.length) {
15 test/test-async.js
View
@@ -893,21 +893,6 @@ exports['nextTick'] = function(test){
}, 50);
};
-exports['nextTick in node'] = function(test){
- if (typeof process === 'undefined') {
- // skip this test in the browser
- return test.done();
- }
- test.expect(1);
- var _nextTick = process.nextTick;
- process.nextTick = function(){
- test.ok(true, 'process.nextTick called');
- process.nextTick = _nextTick;
- test.done();
- };
- async.nextTick(function(){});
-};
-
exports['nextTick in the browser'] = function(test){
if (typeof process !== 'undefined') {
// skip this test in node
Please sign in to comment.
Something went wrong with that request. Please try again.