Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
{
"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
You can’t perform that action at this time.