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

    Type Alias CommonServiceParams<ApiRequest, ApiResponse>

    CommonServiceParams: Partial<GlobalConfig> & {
        signal?: AbortSignal;
        validateRequest?: boolean;
    }

    The parameters every service call shares.

    Type Parameters

    • ApiRequest = any

      The type of the API request object

    • ApiResponse = any

      The type of the API response object

    Type Declaration

    • Optionalsignal?: AbortSignal

      An AbortSignal used to cancel the request.

      Aborting rejects the call with an SDKAbortError (its name is 'AbortError') and cancels the underlying HTTP request, including while the SDK is waiting to retry a rate-limited (429) response. Aborting a call that already completed has no effect.

      To add a deadline, compose signals: AbortSignal.any([mine, AbortSignal.timeout(5000)]).

      Keep only the latest search with createLatestRequest:

      const latestSearch = createLatestRequest();
      const search = await latestSearch.run((signal) => discoverPlaces({ query, signal }));
      if (search.current) showResults(search.value);

      undefined (the request cannot be cancelled)

    • OptionalvalidateRequest?: boolean

      Whether the SDK validates the request parameters against the expected schema before sending them.

      To skip validation, set it to false. The commonBaseURL check (INSECURE_BASE_URL) runs either way.

      true

    They extend the global configuration with service-specific options such as request validation, cancellation, and lifecycle event listeners.