Options
All
  • Public
  • Public/Protected
  • All
Menu

The class responsible for routing and finding match to the correct handler.

Hierarchy

  • Router

Index

Constructors

Accessors

Methods

  • Registers a handler that will be called when an error occurs.

    Parameters

    Returns void

  • navigateTo(absolutePath: string): void
  • Navigates to the given path, it will create a new State instance with the given path. It will then call pushState on the history object with the state and path. Lastly, it will delegate the next steps to {@link Router#navigateWithState} by calling it with the state instance.

    throws

    {@link RouterError} If the router is not started or the path is not absolute.

    Parameters

    • absolutePath: string

      should be an absolute path

    Returns void

  • redirect(absolutePath: string, redirectTo: string): void
  • Redirects navigation to a path to another path.

    Parameters

    • absolutePath: string

      The path to redirect.

    • redirectTo: string

      The path to redirect to when the absolute path is matched.

    Returns void

  • reset(): void
  • Will stop the router and remove all routes and handlers registered.

    Returns void

  • start(): void
  • Start the router with the given options and sets itself as the global router, binds its event listeners to the environment.

    throws

    {@link RouterError} If Navi is already started or if environment is not supported (e.g. no history API).

    Returns void

  • stop(): void
  • Will stop the router and remove all event listeners and removes itself as the global router, does nothing if the router has not started.

    Returns void

  • stop(): void
  • Will call stop on the global router and remove all event listeners. Will do nothing if the router has not started.

    Returns void

Generated using TypeDoc