ViewController interface

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

interface ViewController<TClient extends ViewClient>

The connect, observe and release state machine that every framework binding shares. A binding feeds it the current source and renders current.

Properties

current

readonly current: ViewControllerState<TClient>;

No documentation.

Methods

subscribe

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

Calls listener after each change of current, until the returned function is called.

setSource

setSource(source: ViewSource<TClient>): boolean;

Follows a source. A source with the same identity as the current one (the same client, or a connector with the same connect function) is ignored, so an inline { connect: connectWorkspace } does not reconnect. Returns whether the controller started following a different source. setSource does not notify subscribers; read current after calling it. Later changes (the connection settling, pushed state, retry) notify.

retry

retry(): void;

Connects the current source again, for example after a failure.

dispose

dispose(): void;

Releases the current client and stops publishing. A disposed controller ignores later sources.