developit / developit/workerize

Support pass OffscreenCanvas object.

Aperta
#36 2 commenti 1 reazione 0 assegnatari Vedi su GitHub
Lingua principale
JavaScript
Stelle
4.4k
Fork
87
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

```
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

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.