GoogleChromeLabs / comlink

Comlink makes WebWorkers enjoyable.
Apache License 2.0
11.37k stars 390 forks source link

Q: Should I release proxy()-wrapped callbacks? #590

Open rejhgadellaa opened 2 years ago

rejhgadellaa commented 2 years ago

The language in the README is a bit confusing because proxies refer to wrapped workers but there's also the proxy() method to wrap callbacks:

const worker = Comlink.wrap( new Worker(/* ... */) );
const callback = Comlink.proxy( result => {

});
worker.doWorkAndReport( callback );

Should I do callback[ Comlink.releaseProxy ](); when I no longer need the callback?

ivancuric commented 1 year ago

Related: https://github.com/GoogleChromeLabs/comlink/issues/630