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

    Class TomTomConfig

    The singleton that holds the global configuration of the TomTom Maps SDK.

    Its settings apply to all services and maps, so the whole application shares one configuration.

    The SDK merges the configuration you set here with service-specific parameters, and the service parameters take precedence.

    // Set global configuration
    TomTomConfig.instance.put({
    apiKey: 'your-api-key',
    language: 'en-US'
    });

    // Get current configuration
    const config = TomTomConfig.instance.get();

    // Reset to defaults
    TomTomConfig.instance.reset();
    Index
    instance: TomTomConfig = ...

    The singleton instance of the configuration.

    • Returns the current global configuration.

      Returns GlobalConfig

      const config = TomTomConfig.instance.get();
      console.log(config.apiKey);
    • Merges configuration values into the global configuration.

      New values override existing ones. The merge is shallow, so a nested object replaces the existing one entirely. The exception is a retry object, which takes its missing fields from the default retry config.

      Parameters

      Returns void

      TomTomConfig.instance.put({
      apiKey: 'your-api-key',
      language: 'de-DE'
      });
    • Resets the configuration to its defaults.

      It clears all custom configuration. Note that the default API key is an empty string.

      Returns void

      TomTomConfig.instance.reset();