Skip to content

Instantly share code, notes, and snippets.

@dmcassel
Last active August 29, 2015 14:16
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save dmcassel/c9f69b4e7a35a7aa6574 to your computer and use it in GitHub Desktop.
{
"originalId": "3587258",
"title": "Blocking until event",
"text": "In a web worker, I'm firing off a postMessage() and need to wait for the result before continuing execution. Is there anyway of blocking until the onMessage event occurs, short of busy waiting plus something like Peterson's Algorithm?",
"owner": {
"displayName": "Michael",
},
"accepted": false,
"acceptedAnswerId": null,
"answerCount": 1,
"answers": [
{
"text": "Sounds like you need to break up your script into two parts and fire the second part when the message comes back. That is how any asynchronous call works in the JavaScript world. ",
"owner": {
"displayName": "epascarello",
},
"id": "soa3588111"
}
],
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment