Created
July 4, 2014 15:00
-
-
Save kessler/52c160d1425fa017fc7a to your computer and use it in GitHub Desktop.
simple node.js timers examples
This file contains 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('queue a print AFTER a second') | |
}, 1000) | |
setInterval(function() { | |
console.log('queue a print EVERY second') | |
}, 1000) | |
setImmediate(function() { | |
console.log('queue a print in the next event loop tick but after IO tasks are done') | |
}) | |
process.nextTick(function() { | |
console.log('queue a print at the head of the event loop queue') | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment