A static class that routes URLs within the application.

interface IRouter {
    base: string;
    commands: CommandRegistry;
    current: ILocation;
    routed: ISignal<IRouter, ILocation>;
    stop: Token<void>;
    navigate(path, options?): void;
    register(options): IDisposable;
    reload(): void;
    route(url): void;
}

Implemented by

Properties

base: string

The base URL for the router.

commands: CommandRegistry

The command registry used by the router.

current: ILocation

The parsed current URL of the application.

A signal emitted when the router routes a route.

stop: Token<void>

If a matching rule's command resolves with the stop token during routing, no further matches will execute.

Methods

  • Navigate to a new path within the application.

    Parameters

    • path: string

      The new path or empty string if redirecting to root.

    • Optional options: INavOptions

      The navigation options.

    Returns void

  • Route a specific path to an action.

    Parameters

    • url: string

      The URL string that will be routed.

      Notes

      If a pattern is matched, its command will be invoked with arguments that match the IRouter.ILocation interface.

    Returns void