Interface: PlayActor
API / @xmachines/play-router / PlayActor
Defined in: types.ts:312
The complete actor shape of the PlayRouterProvider component of each framework
adapter: play-solid-router, play-vue-router, play-react-router, and each
adapter on the shared framework router bridge bases.
The shape extends RoutableActor with currentView, because the provider renders
the current view spec and also keeps the routes in step. It therefore needs both
capabilities.
- Use
RoutableActorwhen you need the routing alone, for example in aRouterBridgeBasesubclass, or inconnectRouter. - Use
PlayActorwhen the component also renders the current view spec, for example for the renderer callback parameter ofPlayRouterProvider, and inPlayRenderer.
Every AbstractActor subclass that implements both Routable and Viewable
satisfies this interface structurally.
Example
import type { PlayActor } from "@xmachines/play-router";
function MyRouterProvider({ actor }: { actor: PlayActor }) { // it reads actor.currentRoute for the routing, and actor.currentView for the render}Extends
Properties
| Property | Modifier | Type | Description | Inherited from | Defined in |
|---|---|---|---|---|---|
currentRoute | readonly | Computed<string | null> | The TC39 Signal of the current URL path of the actor, or of its state ID. | RoutableActor.currentRoute | types.ts:274 |
currentView | readonly | State<PlaySpec | null> | The TC39 Signal of the current view spec of the actor, or null when no view is active. | - | types.ts:314 |
initialRoute | readonly | string | null | The route of the initial state of the machine. The constructor fixes it. A router bridge compares it with the browser URL. It therefore separates a deep link, where the router wins, from a restore of a session, where the actor wins. | RoutableActor.initialRoute | types.ts:280 |
Methods
send()
send(event): void;Defined in: types.ts:282
Sends a route navigation event to the actor.
Parameters
| Parameter | Type |
|---|---|
event | PlayRouteEvent |
Returns
void