onBridgeConnection function

Module @runic-artifex/views in @runic-artifex/views 0.23.0

function onBridgeConnection(listener: (state: BridgeConnectionState) => void, options?: BridgeConnectionOptions): () => void;

Observes the current instance's connection to its .NET host (the page's, outside RunicInstance.run). Calls listener with the current state at once, then after each change, until the returned function is called. A host script reports a dropped transport as it happens (Runic Desktop and CS-WebUI within about 250 ms of the WebSocket closing), so the page learns that the host ended without making a call. A host script without onConnectionChange reports only the first connection and each reconnect. The page stops reporting while it unloads, so a reload or navigation does not show reconnecting.