You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ah, you can’t re-use the same postMessage channel for multiple expose() calls. It’s been “used up” already. Maybe that’s something I should change. I’ll think about it.
For now, I’d recommend just defining a function where you pass the parentApi object as a parameter and wrap it in proxyValue(). I whipped up a Glitch (demo, code) using your code as a starting point.
Thanks @surma. It totally helps 👍 Dunno but for me 2 way communication is essential to talk to a remote webpage and back. Your code exposes a really nice way to set this up between browsers. Maybe nice to add to the README?
I did not test yet in a 'real' scenario yet though, as I was hitting cross-origin issues when talking from our company page to a github.io hosted static PWA.
I extended the iframe example a little, see https://gist.github.com/ssured/79471d3e78332e60567012969f716355
When running I get proper results and 2 errors:
Line 67 refers to
comlink/comlink.ts
Line 190 in c2be4ca
Changing this line:
comlink/comlink.ts
Line 187 in c2be4ca
to
if (!event.data.id || !event.data.callPath)
fixes the problem, but I really don't know if thats OK.Thanks for the library. Any help on getting 2 way communication done is greatly appreciated.
The text was updated successfully, but these errors were encountered: