Skip to content

Commit

Permalink
Merge pull request kriskowal#682
Browse files Browse the repository at this point in the history
  • Loading branch information
kriskowal committed Apr 25, 2015
2 parents 2d9b6ab + 8683b09 commit fd9664e
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions q.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,16 @@ var nextTick =(function () {
}
};

if (typeof process !== "undefined" && process.nextTick) {
// Node.js before 0.9. Note that some fake-Node environments, like the
// Mocha test runner, introduce a `process` global without a `nextTick`.
if (typeof process === "object" &&
process.toString() === '[object process]' && process.nextTick) {
// Ensure Q is in a real Node environment, with a `process.nextTick`.
// To see through fake Node environments:
// * Mocha test runner - exposes a `process` global without a `nextTick`
// * Browserify - exposes a `process.nexTick` function that uses
// `setTimeout`. In this case `setImmediate` is preferred because
// it is faster. Browserify's `process.toString()` yields
// '[object Object]', while in a real Node environment
// `process.nextTick()` yields '[object process]'.
isNodeJS = true;

requestTick = function () {
Expand Down

0 comments on commit fd9664e

Please sign in to comment.