You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
thanks, but what if I need the main script to not use "wait" and wait for a response? and the data from threads came already after sending of all messages in threads?
what if I need the main script to not use await and wait for a response?
I think that you can keep the Promise's returned by th.sendRequest(payload), and later, access each result however you like, e.g.
constresult=[];for(letpayloadof['a','b','c','d']){result.push(th.sendRequest(payload));}setTimeout(()=>{// wait for the thread to finish sending all the messagesresult[2].then(x=>console.log(x));// Cresult[1].then(x=>console.log(x));// Bth.terminate();},8000);
Hello. Is it possible to use async/await functions inside nodejs ThreadWorker?
The text was updated successfully, but these errors were encountered: