0

The process is sent to the webworker according to the conditions in a loop as follows.

while () {
 if (~~~) {
   worker.postMessage({ action: "init", data: offscreenCanvas }, [offscreenCanvas]);
 }
・・・
 if (~~~) {
   worker.postMessage({ action: "draw", data: offscreenCanvas }, [offscreenCanvas]);
 }
}

But once the first message was sent, it didn't seem to be sent after that.

Can I only send it once?

I'm using worker-loader.

Kaiido
  • 123,334
  • 13
  • 219
  • 285
yir
  • 11
  • 1
  • If I didn't send offscreenCanvas, all messages have been received. Can I only send offscreenCanvas once? – yir Oct 14 '20 at 17:13
  • I kept the first received offscreenCanvas (in worker.ts) and did not send any more, it seemed to work. I'm not sure if this is the best way to go about it. – yir Oct 14 '20 at 17:32
  • Does this answer your question? [Send offscreencanvas to webworker more than once](https://stackoverflow.com/questions/59598111/send-offscreencanvas-to-webworker-more-than-once) – Kaiido Oct 16 '20 at 07:40

0 Answers0