This is the documentation of version 0.49.0. Go to the latest version, 1.0.0.
TomTom Maps for JavaScript
    Preparing search index...

    Class TomTomConfig

    Global configuration singleton for the TomTom Maps SDK.

    Manages SDK-wide configuration settings that apply to all services and maps. Uses the singleton pattern to ensure consistent configuration across the application.

    Configuration set via this class is merged with service-specific parameters, with service parameters taking precedence over global settings.

    // 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

    Properties

    Methods

    Properties

    instance: TomTomConfig = ...

    Singleton instance of the configuration.

    Methods

    • Get the current global configuration.

      Returns GlobalConfig

      Current configuration object

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

      New values override existing ones. This performs a shallow merge, so nested objects are replaced entirely rather than merged.

      Parameters

      • config: Partial<GlobalConfig>

        Partial configuration to merge

      Returns void

      TomTomConfig.instance.put({
      apiKey: 'your-api-key',
      language: 'de-DE'
      });
    • Reset configuration to default values.

      Clears all custom configuration and restores the initial defaults. Note that the default API key is an empty string.

      Returns void

      TomTomConfig.instance.reset();