As an example
var runInfinite = function(){
while(1)
{
// Do stuff;
}
};
setTimeout(runInfinite, 0);
Is it possible to
I've just tested on my browser.
AFAIK, the while(1) block will literally block the thread and not allow anything else to run. I don't have sources other than experience, but using the Chrome developer toolkit thing ctrl+shift+i
typing while(1){}
will block everything else due to the fact that browser-javascript is single threaded.
However, if you're using node.js
, you may be able to as it has multithreading capabilities. If anyone is familiar enough with node.js
and is willing to answer/edit, go for it. I've never quite used it.