web worker postmessage code example
Example 1: what is webworker
web worker
Web Workers are a mechanism to create a separate thread
in parallel to your main JS program thread.
can only communicate with each other through normal async events
always abide by the event-loop one-at-a-time behavior
required by run-to-completion.
Example 2: web worker multiple data
w.postMessage({user:username,url:server_url})
Example 3: web worker multiple data
onmessage = function (e,f) {
username = e.data.username;
server_url = e.data.url;
}