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

Closed
wants to merge 1 commit into
from

7 participants

@hmalphettes

And fallback to process.nextTick.

Here is how it fails on cloudfoundry's v0.8.2 without this patch:
/var/vcap/data/dea/apps/stoic-0-bda8723f9d67b2926c82dcae327b7902/app/node_modules/async/lib/async.js:90
       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)

@prust

+1

@Shogun147

+1, Node v.0.8.17

@hmalphettes

As a workaround, I use a setImmediate schim: https://github.com/NobleJS/setImmediate

npm install setimmediate

And before using async:

require('setimmediate');
require('async');
@boutils

+1

@hmalphettes

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.
Cheers.

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