Interface: RoutableActor
API / @xmachines/play-router / RoutableActor
Defined in: types.ts:272
The minimal actor interface that RouterBridgeBase and every framework router
adapter require.
This interface, and not AbstractActor<AnyActorLogic> & Routable, gives
RouterBridgeBase.actor.send the type that accepts a PlayRouteEvent directly.
It therefore removes the unsafe cast (actor.send as (e: PlayRouteEvent) => void),
which the weaker EventObject constraint of the actor type needed before.
Every AbstractActor subclass satisfies this interface structurally, for two
reasons:
AbstractActorimplementssend(event: TEvent): void, andTEventaccepts eachEventObject. Therefore it always accepts aPlayRouteEvent, which is a subtype.RoutablegivescurrentRouteandinitialRoute.
Example
import type { RoutableActor } from "@xmachines/play-router";
class MyBridge extends RouterBridgeBase { constructor(actor: RoutableActor, routeMap: RouteMap) { super(actor, routeMap); }}Extended by
Properties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
currentRoute | readonly | Computed<string | null> | The TC39 Signal of the current URL path of the actor, or of its state ID. | types.ts:274 |
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. | 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