ViewClient interface

Namespace @runic-artifex/views · @runic-artifex/views 0.7.0-preview.5

interface ViewClient<TState = unknown>

The framework-neutral surface every generated client shares.

Properties

snapshot

readonly snapshot: TState;

The latest accepted state. After dispose() or a Bridge session change it stays the last state the client accepted.

Methods

subscribe

subscribe(listener: (state: TState) => void): () => void;

Delivers the current state, then each accepted state, until the returned function is called. After dispose() it delivers the last state once and returns a no-op.

dispose

dispose(): void;

Releases this connection. Further calls reject with a disconnected BridgeError.