utils: improve nextTick.
This commit is contained in:
parent
eadb7a50c7
commit
7b928f079c
@ -372,9 +372,18 @@ utils.isEqual = function isEqual(a, b) {
|
|||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO(indutny): use process.nextTick in node.js
|
|
||||||
utils.nextTick = function nextTick(fn) {
|
utils.nextTick = function nextTick(fn) {
|
||||||
setTimeout(fn, 0);
|
if (typeof setImmediate === 'function') {
|
||||||
|
setImmediate(fn);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof process === 'object' && process.nextTick) {
|
||||||
|
process.nextTick(fn);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
setTimeout(fn, 1);
|
||||||
};
|
};
|
||||||
|
|
||||||
function RequestCache() {
|
function RequestCache() {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user