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

    Function setKnob

    • Sets one knob by its catalogue id: checks the value with validateKnobValue, then applies it with every other setting kept.

      Type Parameters

      • CONFIG
      • ID extends string
      • KNOB extends string

      Parameters

      • module: KnobTarget<CONFIG>

        A map module, or a plugin with knobs, such as MapEffects.

      • catalogue: readonly KnobEntry<ID>[]

        Its knob catalogue, e.g. trafficFlowKnobCatalogue for a TrafficFlowModule.

      • id: KNOB

        The knob's id.

      • value: KnobInput<CONFIG, KNOB>

      Returns void

      Nothing changes when the value is invalid. A knob's id is its dotted path into the module's configuration (or, for StylingFoundationsModule, its key there), so the change also shows in getConfig and fires a config-change event.

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

      setKnob(trafficFlow, trafficFlowKnobCatalogue, 'filters.roadCategories.show', 'only');
      setKnob(styling, stylingFoundationsKnobCatalogue, 'labels.sizeFactor', 1.2);