andywer / andywer/threads.js

Should we support passing functions to workers?

Đang mở
#145 25 bình luận 8 reaction 0 người được giao Xem trên GitHub
discussion help wanted
Ngôn ngữ chính
TypeScript
Star
3.5k
Fork
173
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

In v0.x we built the library around the idea of passing functions to the worker that would be serialized, passed as a message, deserialized and then executed in the worker.

This approach has some subtle, yet strong limitations, though. That's why v1.0 does not support passing functions anymore, in order to prevent people from running into those not-always-obvious issues.

Maybe there are use cases where one really needs to be able to pass functions to workers. Then we need to make sure, though, that the user is aware of the passed function's limitations:

- Cannot access any variable declared outside the functions scope
- Cannot `import` or `require()` other modules in the function (at least not in the browser when bundling)

In response to #141, #144.

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.