Skip to content

Interface: RoutableActor

API / @xmachines/play-solid-router / RoutableActor

Defined in: 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

PropertyModifierTypeInherited fromDefined in
currentRoutereadonlyReadonlyAtom<string | null>Routable.currentRouteplay-router/src/types.ts:354
initialRoutereadonlystring | nullRoutable.initialRouteplay-router/src/types.ts:355

Methods

send()

send(event): void;

Defined in: play-router/src/types.ts:394

Sends a route navigation event to the actor.

Parameters

ParameterType
eventPlayRouteEvent

Returns

void