Skip to content

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:61

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.

Type Parameters

Type Parameter
TMachine extends AnyStateMachine

Parameters

ParameterTypeDescription
BasePlayerConstructor<TMachine>The actor class to extend, normally PlayerActor or the result of another capability.

Returns

PlayerConstructor<TMachine, Viewable>