class ActivityRouter
A class that manages activation and deactivation of activities, with support for path-based routing.
class ActivityRouter extends ObservableObject;
Description
Activities can be added using add() for manual management, or registered with a route pattern using route(). Route-registered activities are automatically activated and deactivated based on navigation path changes. However, routes are normally managed in one go using app.addRoutes().
A single instance of this class is available as app.activities, which can be used to read (or bind to) the current set of activated activities or route parameters.
Constructor
new ActivityRouter()
Creates a new activity router.
Type members
type ActivityRouter.ParamNames static
Extracts parameter names from a route pattern string.type ActivityRouter.HasWildcard static
True if the pattern ends with a wildcard.type ActivityRouter.RouteParams static
The parameter types extracted from a route pattern.type ActivityRouter.RouteArg static
A route argument: either an Activity instance (by reference) or a factory function.type ActivityRouter.RouteTable static
A route table mapping patterns to one or more route arguments.
Instance members
active readonly
The list of currently active route-matched activities.params
The current route parameters.matchedRoute
The route pattern that matched most recently.isEmpty()
Returns true if the router does not have any registered activities or routes.add()
Adds an activity to this router.route()
Registers a route pattern with one or more activities or factory functions.clear()
Removes all activities and route registrations.routeAsync()
Routes to matching activities for the given path.
Inherited members
emit()
Emits an event, immediately calling all event handlers.emitChange()
Emits a change event.listen()
Adds a handler for all events emitted by this object.listenOnce()
Returns a promise for a single event with the provided name.listenAsync()
Adds a handler for all events emitted by this object, and returns an async iterable.observe()
Observes a property, a bound property from an attached parent, or an observable object.observeAsync()
Observes one or more targets asynchronously, batching or debouncing/throttling updates.attach() protected
Attaches the specified observable object to this object.isUnlinked()
Returns true if the object has been unlinked.unlink()
Unlinks this observable object.beforeUnlink() protected
A method that’s called immediately before unlinking an object, can be overridden.
