nanha
2/4/2012 - 11:35 AM

nextTick will ALWAYS fire before a setTimeout from the same tick

nextTick will ALWAYS fire before a setTimeout from the same tick

Tue, 29 Mar 2011 23:48:59 GMT
Tue, 29 Mar 2011 23:49:01 GMT
nextTick
timeout
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');
});