Skip to content

Instantly share code, notes, and snippets.

@ku1ik
Created July 28, 2012 11:26
Show Gist options
  • Save ku1ik/3192915 to your computer and use it in GitHub Desktop.
Save ku1ik/3192915 to your computer and use it in GitHub Desktop.
<html>
<head>
<script id="worker1" type="javascript/worker">
function work() {
postMessage('work');
setTimeout(work, 3);
}
work();
setInterval(function() { postMessage('ping') }, 500);
</script>
<script>
function init() {
var bb = new MozBlobBuilder();
bb.append(document.querySelector('#worker1').textContent);
var w = new Worker(window.URL.createObjectURL(bb.getBlob()));
w.onmessage = function(e) {
console.log(e.data);
}
};
</script>
</head>
<body onload="init()">
</body>
</html>
@ku1ik
Copy link
Author

ku1ik commented Jul 28, 2012

You can observe that in FF v12-14 setInterval() works fine but setTimeout() stops triggerring after a few iterations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment