Function: withView()
API / @xmachines/play-xstate / with-view / withView
function withView<TMachine>(Base): PlayerConstructor<TMachine, Viewable>;Defined in: packages/play-xstate/src/with-view.ts:99
Adds the view capability to an actor class.
The ORDER of the composition does not matter. currentView and currentRoute are two
computed atoms over state, and neither reads the other, so the engine evaluates both
from one write in topological order. An earlier release wrote currentView from an
onSnapshot override, and the order then decided which capability held its new value
first.
Type Parameters
| Type Parameter |
|---|
TMachine extends AnyStateMachine |
Parameters
| Parameter | Type | Description |
|---|---|---|
Base | PlayerConstructor<TMachine> | The actor class to extend, normally PlayerActor or the result of another capability. |
Returns
PlayerConstructor<TMachine, Viewable>