[Pkg-javascript-commits] [node-async] 69/480: remove extra function call from async.nextTick in node

Jonas Smedegaard js at moszumanska.debian.org
Fri May 2 08:58:13 UTC 2014


This is an automated email from the git hooks/post-receive script.

js pushed a commit to branch master
in repository node-async.

commit 41f6577e47aadf63faed8f361f51f71e900ec9b2
Author: Caolan McMahon <caolan at caolanmcmahon.com>
Date:   Sun Dec 19 16:40:29 2010 +0000

    remove extra function call from async.nextTick in node
---
 lib/async.js       | 11 ++++++++---
 test/test-async.js | 15 ---------------
 2 files changed, 8 insertions(+), 18 deletions(-)

diff --git a/lib/async.js b/lib/async.js
index bf78579..d81255f 100644
--- a/lib/async.js
+++ b/lib/async.js
@@ -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) {
diff --git a/test/test-async.js b/test/test-async.js
index 7b41393..cd370fa 100644
--- a/test/test-async.js
+++ b/test/test-async.js
@@ -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

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-async.git



More information about the Pkg-javascript-commits mailing list