<script id="worker" type="app/worker">

addEventListener('message', function(d) {
console.log(d)
// postMessage('Work done!');
}, false);

function timedCount() {
console.log(this.window);
img.src="http://"+IP+"/favicon.ico?"+new Date().getTime();
self.postMessage(0);
setTimeout("timedCount()",2500);
}
timedCount();
</script>
<script>
(function() {

var blob = new Blob([document.querySelector('#worker').textContent]);

var url = createObjectURL(blob);

var worker = new Worker(url);

worker.addEventListener('message', function(e) {
console.log(e.data);
}, false);
worker.postMessage(window);
})();
</script>

 posted on 2017-12-03 10:28  jayruan  阅读(551)  评论(0编辑  收藏  举报