Skip to content

Type Alias: Capability<TMachine, TAdded>

API / @xmachines/play-xstate / index / Capability

type Capability<TMachine, TAdded> = (Base) => PlayerConstructor<TMachine, TAdded>;

Defined in: packages/play-xstate/src/capabilities.ts:69

One capability of an actor: a function that takes an actor class and answers the same class with TAdded on the instance.

withRouting of @xmachines/play-xstate/routing and withView of @xmachines/play-xstate/view are the two that this package ships. Write your own with the same shape, and compose takes it beside them.

Type Parameters

Type ParameterDescription
TMachine extends AnyStateMachineThe machine of the actor.
TAdded extends objectWhat the capability adds to the instance, for example Routable.

Parameters

ParameterType
BasePlayerConstructor<TMachine>

Returns

PlayerConstructor<TMachine, TAdded>