Detect the absence of setImmediate for nodejs-v0.8 and lesser #271

wants to merge 1 commit into

7 participants


And fallback to process.nextTick.

Here is how it fails on cloudfoundry's v0.8.2 without this patch:
       async.setImmediate = setImmediate;
ReferenceError: setImmediate is not defined
   at /var/vcap/data/dea/apps/stoic-0-bda8723f9d67b2926c82dcae327b7902/app/node_modules/async/lib/async.js:90:30
   at Object. (/var/vcap/data/dea/apps/stoic-0-bda8723f9d67b2926c82dcae327b7902/app/node_modules/async/lib/async.js:947:2)
   at Module._compile (module.js:449:26)




+1, Node v.0.8.17


As a workaround, I use a setImmediate schim:

npm install setimmediate

And before using async:




An almost equivalent patch is committed for 0.2.7 here: b00f5f4

I am guessing @caolan preferred to look for "typeof setImmediate !== 'undefined' " rather than "typeof setImmediate === 'function' "
in case setImmediate ends up to no be a function.

Anyways all is good in node-0.8 land again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment