valhalla-browser API
    Preparing search index...

    Class Router

    A lazy browser routing session. Native operations are serialized in one dedicated Web Worker.

    Index
    options: RouterOptions

    Session configuration; relative manifest and asset URLs resolve against the page.

    startup?: StartupResult

    Measurements from the most recent successful initialization; cleared on cancellation or failure.

    • Load the runtime and pinned dataset metadata. Concurrent calls share startup.

      Returns Promise<StartupResult>

      Initialization timings and dataset/native identity.

      RoutingError for asset, dataset, network, cancellation or disposed-session failures.

      A failed initialization can be retried on the same Router.

    • Calculate a driving route, initializing lazily and queuing behind other native operations.

      Parameters

      • request: RouteRequest

        Start/end coordinates and the optional validated driving profile.

      • __namedParameters: { signal?: AbortSignal } = {}

      Returns Promise<RouteResult>

      Complete native JSON, dataset identity and per-route measurements.

      RoutingError for invalid input, coverage/no-route, transport or lifecycle failures.

      Aborting the signal terminates the worker and rejects all pending operations, including other queued routes. A subsequent route starts a new worker with an empty cache.