GoogleChromeLabs / GoogleChromeLabs/comlink
Expose main to worker, same remote-object-style
Open
- Dominant language
- TypeScript
- Stars
- 12.8k
- Forks
- 435
- PR merge metrics
- No merged PRs in 30d
Description
Could not find this in examples.
[`worker-rpc`](https://www.npmjs.com/package/worker-rpc) allows the worker to request values from main in a similar manner, (`await remote.func()`).
I understand you can pass callbacks using `Comlink.proxy`, but in some cases (an apparent) direct duplex communication indicates the intent better than passing the ball back-and-forth where the main should has first call a function, then the worker must memoize the callback etc.
Is this kind of duplex communication also possible with Comlink? What would be an example?
Thanks!
Contributor guide
Assessment
This issue has not been assessed yet.