Permalink
Browse files

Changed async.nextTick to be defined once based on whether process.ne…

…xtTick is available.
  • Loading branch information...
1 parent eac373d commit b2d7e69fe289d4dc66feedd4bb3193849712948c @kpozin kpozin committed with caolan Dec 16, 2010
Showing with 3 additions and 8 deletions.
  1. +3 −8 lib/async.js
View
@@ -79,14 +79,9 @@
//// exported async module functions ////
//// nextTick implementation with browser-compatible fallback ////
- async.nextTick = function (fn) {
- if (typeof process === 'undefined' || !(process.nextTick)) {
- setTimeout(fn, 0);
- }
- else {
- process.nextTick(fn);
- }
- };
+ async.nextTick = (typeof process === 'undefined' || !(process.nextTick)) ?
+ function(fn) { setTimeout(fn, 0); } :
+ function(fn) { process.nextTick(fn) };
async.forEach = function (arr, iterator, callback) {
if (!arr.length) {

0 comments on commit b2d7e69

Please sign in to comment.