Interface: RoutableActor
API / @xmachines/play-router / index / RoutableActor
Defined in: packages/play-router/src/types.ts:392
The minimal actor interface that RouterBridgeBase and every framework router
adapter require.
It names send itself, and it therefore gives RouterBridgeBase.actor.send a type that
accepts a PlayRouteEvent directly. That removes the unsafe cast
(actor.send as (e: PlayRouteEvent) => void).
It is Routable with send. The two members of the capability are declared once,
in Routable, and this interface extends it. A copy of them here drifts the day that
one of the two files changes.
It names the view NOWHERE. Routing implies no rendering. No file of this package,
and no file of any of the eight router adapters, ever reads currentView. A provider
whose renderer callback reads the view binds its own TActor, and a constraint keeps
the concrete type of the actor whole, so that callback still reads the exact spec of
that actor.
Every PlayActor of @xmachines/play-actor that also implements Routable, and whose
event union holds PlayRouteEvent, satisfies this interface structurally. A machine
that declares no route event does NOT satisfy it, and that refusal is correct: a bridge
cannot navigate an actor that receives no route event.
Example
import type { RoutableActor } from "@xmachines/play-router";
class MyBridge extends RouterBridgeBase { constructor(actor: RoutableActor, routeMap: RouteMap) { super(actor, routeMap); }}Extends
Properties
| Property | Modifier | Type | Inherited from | Defined in |
|---|---|---|---|---|
currentRoute | readonly | ReadonlyAtom<string | null> | Routable.currentRoute | packages/play-router/src/types.ts:354 |
initialRoute | readonly | string | null | Routable.initialRoute | packages/play-router/src/types.ts:355 |
Methods
send()
send(event): void;Defined in: packages/play-router/src/types.ts:394
Sends a route navigation event to the actor.
Parameters
| Parameter | Type |
|---|---|
event | PlayRouteEvent |
Returns
void