This example shows how to set up Comlink between a window and an embedded iframe using Comlink.windowEndpoint().
Comlink.windowEndpoint()