developit / developit/workerize
Support pass OffscreenCanvas object.
- Vorherrschende Sprache
- JavaScript
- Sterne
- 4.4k
- Forks
- 87
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
```
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
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Rechercherichtung
Start with the reproduction in the issue and inspect workerize's argument-passing and postMessage path. Read the linked Transferable documentation, then verify that an OffscreenCanvas reaches the worker without the cloning exception and that drawImage runs successfully.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- javascript
- Bereich
- frontend, web-dev
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100