标签:fun func www event sage 主线程 div new receive
主线程:
var worker = new Worker(‘work.js‘); //新建一个 Worker 线程 //监听worker线程消息 worker.onmessage = function (event) { console.log(‘Received message ‘ + event.data); } //给worker线程发消息 worker.postMessage(‘Work done!‘);
worker线程:
//监听主线程的消息 addEventListener(‘message‘, function (e) { postMessage(‘You said: ‘ + e.data); //给主线程发消息 }, false);
详细使用教程:http://www.ruanyifeng.com/blog/2018/07/web-worker.html
标签:fun func www event sage 主线程 div new receive
原文地址:https://www.cnblogs.com/zhq195/p/9994646.html