I want to draw in a Worker thread using OffscreenCanvas

173 views Asked by At

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.

0

There are 0 answers