mirror of https://github.com/lukechilds/node.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
468 B
21 lines
468 B
9 years ago
|
'use strict';
|
||
|
|
||
|
if (!process.version ||
|
||
|
process.version.indexOf('v0.') === 0 ||
|
||
|
process.version.indexOf('v1.') === 0 && process.version.indexOf('v1.8.') !== 0) {
|
||
|
module.exports = nextTick;
|
||
|
} else {
|
||
|
module.exports = process.nextTick;
|
||
|
}
|
||
|
|
||
|
function nextTick(fn) {
|
||
|
var args = new Array(arguments.length - 1);
|
||
|
var i = 0;
|
||
|
while (i < args.length) {
|
||
|
args[i++] = arguments[i];
|
||
|
}
|
||
|
process.nextTick(function afterTick() {
|
||
|
fn.apply(null, args);
|
||
|
});
|
||
|
}
|