Open janryWang opened 5 years ago
const worker = workerize(` export function drawImage(canvas,image){ return canvas.getContext("2d").drawImage(image, 0, 0)} `)(canvas, image) worker.drawImage(document.querySelector('canvas'). transferControlToOffscreen(),img)
it will throw
DOMException: Failed to execute 'postMessage' on 'Worker': An OffscreenCanvas could not be cloned because it was not transferred.
https://developer.mozilla.org/en-US/docs/Web/API/Transferable
@developit
i am also interested in this, because i'd like to workerize the webp-hero polyfill, which will best be implemented with a transferable OffscreenCanvas
OffscreenCanvas
it will throw
https://developer.mozilla.org/en-US/docs/Web/API/Transferable