Skip to content

Support pass OffscreenCanvas object. #36

Description

@janryWang
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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions