Created
March 29, 2011 23:49
-
-
Save laverdet/893590 to your computer and use it in GitHub Desktop.
nextTick will ALWAYS fire before a setTimeout from the same tick
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
setTimeout(function() { | |
console.log('timeout'); | |
}, 0); | |
// simulate extreme cpu load | |
var d = +new Date; | |
console.log(new Date); | |
while (d + 2000 > new Date); | |
console.log(new Date); | |
process.nextTick(function() { | |
console.log('nextTick'); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Tue, 29 Mar 2011 23:48:59 GMT | |
Tue, 29 Mar 2011 23:49:01 GMT | |
nextTick | |
timeout |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment