- From: Alexey Proskuryakov <ap@webkit.org>
- Date: Wed, 5 Nov 2008 17:56:42 +0300
Nov 5, 2008, ? 1:11 AM, Jonas Sicking ???????(?): > main.js: > w = new Worker('worker.js'); > p = w.connect(); > p.postMessage(17); > p.onmessage = function(e) { > answer = e.data; > } I prefer to think of it as: window.onload = function() { var worker = new Worker('encrypt.js'); var workerPort = worker.connect(); workerPort.onmessage = processWorkerReply; } function spawnEncryptData(id, data) { workerPort.postMessage("encrypt " + id + " " + data); } Aside from one time setup (which usually needs to be performed in advance), the "simple case" looks no different, but there is no confusion about which port to use. - WBR, Alexey Proskuryakov
Received on Wednesday, 5 November 2008 06:56:42 UTC