mirror of https://github.com/lukechilds/node.git
Browse Source
This is a replacement for the common hack: setTimeout(cb, 0); It's much more efficient.v0.7.4-release
Ryan Dahl
15 years ago
4 changed files with 61 additions and 6 deletions
@ -0,0 +1,28 @@ |
|||||
|
process.mixin(require("./common")); |
||||
|
|
||||
|
var complete = 0; |
||||
|
|
||||
|
process.nextTick(function () { |
||||
|
complete++; |
||||
|
process.nextTick(function () { |
||||
|
complete++; |
||||
|
process.nextTick(function () { |
||||
|
complete++; |
||||
|
}); |
||||
|
}); |
||||
|
}); |
||||
|
|
||||
|
setTimeout(function () { |
||||
|
process.nextTick(function () { |
||||
|
complete++; |
||||
|
}); |
||||
|
}, 50); |
||||
|
|
||||
|
process.nextTick(function () { |
||||
|
complete++; |
||||
|
}); |
||||
|
|
||||
|
|
||||
|
process.addListener('exit', function () { |
||||
|
assert.equal(5, complete); |
||||
|
}); |
Loading…
Reference in new issue