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
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. A connector whose client another controller let go of within its keepAlive period takes that client over, with its state at once and without pending. setSource does not notify subscribers; read current after calling it. Later changes (the connection settling, pushed state, retry) notify.
release
release(): void; Lets go of the client for keepAlive milliseconds and stops following it, but keeps current, so a binding that is unmounted or hidden shows its last state again at once. The next setSource, also with the same source, follows it again and takes the kept client back. Does not notify.
retry
retry(): void; Connects the current source again, for example after a failure.
dispose
dispose(): void; Lets go of the current client, as release does, and stops publishing. A disposed controller ignores later sources.