ai / ai/offscreen-canvas

Nit, this isn't a polyfill

Đang mở
#34 1 bình luận 1 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
JavaScript
Star
342
Fork
15
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

This doesn't work as expected on mac/safari as discussed in this other issue.

[> [Mac/safari] will work, but use normal canvas without offscreen and web worker](https://github.com/ai/offscreen-canvas/issues/31#issuecomment-1013018932)

So then this isn't a polyfill then? This is a library that wraps offscreen canvas if available.

To me a polyfill implements the API for platforms that don't support it using the standard interface. This library requires users to a non-standard interface.

Furthermore it would be ideal if the polyfill could actually provide the desired functionality, in this case being able to offload canvas work to another web worker.

I think this could be done with iframes and proxies.

```mermaid
sequenceDiagram
main->>iframe: create canvas in iframe
main->>worker: use this offscreen canvas proxy
worker->>iframe: ctx.draw...
worker->>iframe: ctx.draw...
main->>+worker: getImageData
worker->>+iframe: forwardImageData
iframe-->>-main: ImageData
```

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.