Created
January 7, 2016 22:50
-
-
Save ray-peters/a223b8043f785b78f641 to your computer and use it in GitHub Desktop.
Testing what throws do to the event loop
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
var queueJob = function(){ | |
var total = 0; | |
return function( count ) { | |
count || ( count = 1 ); | |
for ( var i = 0; i < count; ++i ) { | |
setTimeout( function(){ | |
++total; | |
console.log( "job: ", total ); | |
}, 0 ); | |
} | |
}; | |
}(); | |
queueJob(); | |
setTimeout( function(){ | |
throw "le break"; | |
}, 0 ); | |
queueJob(); | |
var g = function() { return 1; }, | |
f = function() { | |
var ret = 0, | |
i = 1; | |
for ( ; i < 10000000; ++i ) { | |
ret += g(); | |
} | |
return ret; | |
}; | |
f(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment