Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fallback to nextTick if setImmediate is not a function

  • Loading branch information...
commit c1de4d6a533cf6cfb8c275c8f4c65da8b03b0107 1 parent 7f760fb
Jaakko Manninen authored
Showing with 7 additions and 1 deletion.
  1. +7 −1 lib/ncp.js
View
8 lib/ncp.js
@@ -43,9 +43,15 @@ function ncp (source, dest, options, callback) {
return getStats(source);
}
+ function defer(fn) {
+ if (typeof(setImmediate) === 'function')
+ return setImmediate(fn);
+ return process.nextTick(fn);
+ }
+
function getStats(source) {
if (running >= limit) {
- return setImmediate(function () {
+ return defer(function () {
getStats(source);
});
}
Please sign in to comment.
Something went wrong with that request. Please try again.