-
Notifications
You must be signed in to change notification settings - Fork 30k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
worker: parentPort.postMessage fails on undefined value #26122
Comments
3 tasks
legendecas
added a commit
to legendecas/node
that referenced
this issue
Feb 17, 2019
I have this code in my worker file which i trigger but this method dose not sending the selected data to up _selectRandomQuestion(){
// get random number base on the question length
const randomIndex=Math.floor(Math.random()*this.#match_question.length)
// storing selected question
this.#_selectedQuestion=this.#match_question[randomIndex]
console.log('selected question =>')
console.log(this.#_selectedQuestion)
// removing selected question from array
this.#match_question.splice(randomIndex,1)
// sends selected question out of worker
return parentPort.postMessage({
"E":quizGameEventNames.NEXT_QUESTION,
"D":{
"data":{
"question":this.#_selectedQuestion
}
}
})
}
```
the worker.on("message") dosen't get anything why? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
parentPort.postMessage
fails on assumption of not nil of first argument. Though it's documented as accepting any value.full scripts:
The text was updated successfully, but these errors were encountered: