Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support pass OffscreenCanvas object. #36

Open
janryWang opened this issue Mar 26, 2019 · 2 comments
Open

Support pass OffscreenCanvas object. #36

janryWang opened this issue Mar 26, 2019 · 2 comments

Comments

@janryWang
Copy link

janryWang commented Mar 26, 2019

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

@janryWang
Copy link
Author

@developit

@chase-moskal
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants