Draw some shapes with simple Web Workers API
To view the message between the main and the Worker, view the message using the Web Developer Tools of your browser.
The main script will first transfer the canvas as an
offscreenCanvas
using
canvas.transferControlToOffscreen();
.
After that the Worker will draw on the canvas.