Skip to content

Interface: Routable

Documentation / @xmachines/play-actor / Routable

Defined in: packages/play-actor/src/abstract-actor.ts:41

Optional capability: Routing support

Actors implementing this interface can derive a route from their state. Router adapters observe the currentRoute signal to sync browser URLs.

Example

class MyActor extends AbstractActor implements Routable {
currentRoute = new Signal.Computed(() => deriveRoute(this.state.get()));
}
// Router requires Routable
function connectRouter<T extends AbstractActor & Routable>(actor: T) {
watcher.watch(actor.currentRoute);
}

Properties

PropertyModifierTypeDescriptionDefined in
currentRoutereadonlyComputed<string | null>Current route signal Computed signal derived from state machine. Infrastructure observes to sync browser URL. Invariant: Passive Infrastructure - Infrastructure reflects route, never decides. Example const watcher = new Signal.subtle.Watcher(() => { const route = actor.currentRoute.get(); console.log('Route changed:', route); }); watcher.watch(actor.currentRoute);packages/play-actor/src/abstract-actor.ts:58