(event: MessageEvent)
| 74 | |
| 75 | export function installRuntimeControlBridge(deps: BridgeDeps): (event: MessageEvent) => void { |
| 76 | const handler = (event: MessageEvent) => { |
| 77 | const data = event.data as BridgeControlData | null; |
| 78 | if (!data || data.source !== "hf-parent" || data.type !== "control") return; |
| 79 | const action = data.action; |
| 80 | if (typeof action !== "string") return; |
| 81 | const fn = CONTROL_HANDLERS[action]; |
| 82 | if (fn) fn(data, deps); |
| 83 | }; |
| 84 | window.addEventListener("message", handler); |
| 85 | // Announce that the bridge listener is installed so the parent can replay |
| 86 | // any control messages it posted before the iframe runtime was ready |
no outgoing calls
no test coverage detected