This is the documentation of version 1.0.0-rc.4. Go to the latest version, 1.0.0-rc.5.
TomTom Maps for JavaScript
    Preparing search index...

    Type Alias LatestRequest

    A request slot that keeps only the latest answer, where each request retires the ones started before it, as LatestRequestOptions.supersede sets.

    type LatestRequest = {
        cancel: () => void;
        isRunning: () => boolean;
        run: <T>(
            request: (signal: AbortSignal) => Promise<T>,
        ) => Promise<LatestRequestResult<T>>;
    }
    Index
    cancel: () => void

    Aborts every request in flight without starting another, so each resolves { current: false }.

    isRunning: () => boolean

    Whether a request is in flight and not yet retired.

    run: <T>(
        request: (signal: AbortSignal) => Promise<T>,
    ) => Promise<LatestRequestResult<T>>

    Starts this request, and retires the ones started before it when it starts or when it answers.

    Type Declaration

      • <T>(
            request: (signal: AbortSignal) => Promise<T>,
        ): Promise<LatestRequestResult<T>>
      • Type Parameters

        • T

        Parameters

        • request: (signal: AbortSignal) => Promise<T>

          The work to run, typically one or more service calls sharing the signal

        Returns Promise<LatestRequestResult<T>>

    request is called synchronously with a fresh signal, which it passes to every service call it makes. Retiring a request aborts its signal. A rejection is rethrown only while the request is still current, so a deadline of your own composed onto the signal still surfaces as an SDKAbortError.