Created
April 13, 2010 19:03
-
-
Save mranney/364949 to your computer and use it in GitHub Desktop.
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
var sys = require('sys'); | |
process.nextTick(function () { | |
sys.puts("Running from nextTick"); | |
}) | |
setTimeout(function () { | |
sys.puts("Running from setTimeout 0."); | |
}, 0); | |
setTimeout(function () { | |
sys.puts("Running from setTimeout 1."); | |
}, 1); | |
setTimeout(function () { | |
sys.puts("Running from setTimeout 10."); | |
}, 10); | |
setTimeout(function () { | |
sys.puts("Running from setTimeout 50."); | |
}, 50); | |
sys.puts("Running from main."); |
mjr:~$ node timing.js
Running from main.
Running from setTimeout 0.
Running from setTimeout 1.
Running from setTimeout 10.
Running from nextTick
Running from setTimeout 50.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
mjr:~$ node timing.js
Running from main.
Running from setTimeout.
Running from nextTick