Function: withRouting()
API / @xmachines/play-xstate / with-routing / withRouting
function withRouting<TMachine>(Base): PlayerConstructor<TMachine, Routable>;Defined in: packages/play-xstate/src/with-routing.ts:46
Adds the routing capability to an actor class.
The result satisfies Routable, so a router bridge accepts it. A class without this
mixin exposes no currentRoute, and a bridge therefore refuses it when it compiles,
rather than at the first navigation.
The mixin declares NO constructor, and that is deliberate: TypeScript demands the
signature ...args: any[] from a mixin over a generic base (TS2545), and this
workspace writes no any. A field initializer of a subclass runs after super()
instead, and it reads the inputs that PlayerActor keeps for a capability.
Type Parameters
| Type Parameter |
|---|
TMachine extends AnyStateMachine |
Parameters
| Parameter | Type | Description |
|---|---|---|
Base | PlayerConstructor<TMachine> | The actor class to extend, normally PlayerActor. |
Returns
PlayerConstructor<TMachine, Routable>