An individual item that will be displayed by a RouterNavigator component. Provides the URL path pattern, the view, and an optional list of events to map to actions (like push or pop navigation) performed by the RouterNavigator.

To determine which Route to use, the RouterNavigator matches the current URL against the path patterns defined by the Route objects.

Path patterns must start with a forward slash / character. Do not include the host/domain part of the URL.

Path patterns support named parameters that start with a : colon character. For example, the path pattern /:foo/:bar has named parameters with the names "foo" and "bar". If the display object returned by the Route implements the IRouteView interface, the name parameters are passsed to the view for additional parsing.

Named parameters may be made optional by appending a ? question mark character. For example, the "foo" parameter is optional in the path pattern /baz/:foo?, and it will also match "/baz" without the parameter.

If the path pattern is null or an empty string, it will always match.

If the RouterNavigator defines a basePath, path patterns should not include the base path. It will be handled automatically.

Available since

1.0.0

.

See also:

Static methods

staticwithClass<T>(path:String, viewClass:Class<T>, ?actions:Map<String, RouterAction>, ?updateState:(view:T, state:RouteState) ‑> Void, ?saveData:(view:T) ‑> Dynamic):Route

Creates a Route that instantiates a view from a class that extends DisplayObject when the RouterNavigator requests the item's view.

Available since

1.0.0

.

staticwithDisplayObject<T>(path:String, viewInstance:T, ?actions:Map<String, RouterAction>, ?updateState:(view:T, state:RouteState) ‑> Void, ?saveData:(view:T) ‑> Dynamic):Route

Creates a Route that always returns the same DisplayObject instance when the RouterNavigator requests the item's view.

Available since

1.0.0

.

staticwithFactory<T>(path:String, viewFactory:AbstractDisplayObjectFactory<T, DisplayObject>, ?actions:Map<String, RouterAction>, ?updateState:(view:T, state:RouteState) ‑> Void, ?saveData:(view:T) ‑> Dynamic):Route

Creates a Route that with a DisplayObjectFactory when the RouterNavigator requests the item's view.

Available since

1.3.0

.

staticwithFunction<T>(path:String, viewFunction:() ‑> T, ?actions:Map<String, RouterAction>, ?updateState:(view:T, state:RouteState) ‑> Void, ?saveData:(view:T) ‑> Dynamic):Route

Creates a Route that calls a function that returns a DisplayObject when the RouterNavigator requests the item's view.

Available since

1.0.0

.

staticwithRedirect(path:String, redirectTo:String):Route

Creates a Route that redirects to a different path.

Variables

path:String

The URL path associated with this route.

Available since

1.0.0

.

Methods

dynamicsaveData(view:Dynamic):Dynamic

An optional function to save the view's data before navigating away.

Available since

1.0.0

.

setAction(eventType:String, action:RouterAction):Void

Sets a new action to perform when the view dispatches an event. If the action is null, removes an action that was set previously.

Available since

1.0.0

.

dynamicupdateState(view:Dynamic, routeState:RouteState):Void

An optional function to customize the view before it is shown.

Available since

1.0.0

.