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

    Function setKnob

    • Sets one knob of a module by its catalogue id: checks the value with validateKnobValue, then applies the module's configuration with the value at the knob's path and every other setting kept.

      Type Parameters

      Parameters

      • module: Pick<AbstractMapModule<SourcesWithLayers, CONFIG>, "getConfig" | "applyConfig">
      • catalogue: readonly KnobEntry<ID>[]

        The module's knob catalogue, e.g. trafficFlowKnobCatalogue for a TrafficFlowModule.

      • id: KNOB

        The knob's id, its path in the module's configuration.

      • value: KnobPlainValue<ValueAt<CONFIG, KNOB>>

      Returns void

      Nothing changes when the value is invalid. StylingModule sets its knobs with its own set.

      RangeError for a value the knob does not take; Error for an id the catalogue lacks.

      setKnob(trafficFlow, trafficFlowKnobCatalogue, 'filters.any.0.roadCategories.show', 'only');
      setKnob(analytics, trafficAreaAnalyticsKnobCatalogue, 'metricConfig.speed.height.maxHeightMeters', 2000);