Created
February 28, 2017 09:07
-
-
Save psiphi75/2e5b7bd41ed4533a7a03e78f6bfc3181 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ... continuing from code above. | |
// We create the worker, the work can actally begin (but will give the | |
// worker a message to start later). | |
var worker = new UniversalWorker(uri); | |
// Listen to all messages from the worker. | |
worker.addEventListener('message', waitForResult, { once: true }); | |
// We send a message to the worker, this can be any primitive or object, | |
// including arrays. | |
worker.postMessage('Start your work'); | |
function waitForResult(resultMessageFromWorker) { | |
// ... do something with the result | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment