interface RunicBridgeClient The host bridge a host script installs as globalThis.__runicBridge (Views protocol 4, specs/application, "Host bridge"), or that createRunicInstance is given. Messages cross it as JSON text; the Views runtime parses each one once.
Methods
isConnected
isConnected(): boolean; Whether the host connection is open and authenticated.
request
request(message: string): Promise<string>; Sends one request as JSON text and resolves with the reply as JSON text. Rejects when the transport fails before a reply arrives.
onMessage
onMessage(listener: (message: string) => void): () => void; Calls listener with the JSON text of each push, in order, until the returned function is called. Pushes received while no listener exists are dropped. The page's Views runtime is the only listener.
onConnectionChange
onConnectionChange(listener: (connected: boolean) => void): () => void; Calls listener(connected) at once and after each change, until the returned function is called. A host reports false before the true of a new connection, so each true after false is a new connection, which needs its own hello. It has none of the side effects that isConnected() may have.