GoogleChromeLabs / comlink

Comlink makes WebWorkers enjoyable.
Apache License 2.0
11.48k stars 394 forks source link

How to releaseProxy from the `expose()` side? #674

Open HuakunShen opened 3 weeks ago

HuakunShen commented 3 weeks ago

I am exposing JS object to iframe from the main thread. When I navigate between pages, the object gets exposed to iframe window multiple times, and got repeated requests. If I enter the page with iframe 3 times, a request from iframe will trigger 3 times.

After some experiment I found that if I releaseProxy from within iframe, the problem is gone. But I don't have full control over the content in iframe, thus need to find a way to release proxy from the expose() side (main thread)

michalkvasnicak commented 1 week ago

I have same issue, need to be able to clean up after expose().

HuakunShen commented 1 week ago

It seems like no one is reponding to thr issues, I ended up implementing my own rpc library. I works so great so far for myself.

https://docs.kkrpc.kunkun.sh