TomTom Maps for JavaScript
    Preparing search index...

    Type Alias PutEventStateOptions

    PutEventStateOptions: ByIdOrIndex & {
        mode?: "put" | "add";
        show?: boolean;
        state: EventType;
    }

    Parameters to update the event state of a feature programmatically.

    Allows you to manually set event states on features, useful for:

    • Programmatic selection/highlighting
    • Keyboard navigation
    • External state synchronization
    • Testing and automation

    Type Declaration

    • Optionalmode?: "put" | "add"

      Whether to replace or add to existing event states.

      • put: Set the event state on this feature and remove it from all others (default)
      • add: Set the event state on this feature while preserving states on other features
      'put'
      
      // Exclusive selection (only one can be clicked at a time)
      mode: 'put'

      // Multiple selection (keep existing selections)
      mode: 'add'
    • Optionalshow?: boolean

      Whether to show the feature after updating the event state.

      Set to false only if you want to make multiple state changes before rendering, which can improve performance for batch updates.

      true
      
      // Update and render immediately
      show: true

      // Update without rendering (for batch operations)
      show: false
    • state: EventType

      The event state to set.

      Can be any supported event type: 'click', 'contextmenu', 'hover', or 'long-hover'.

    // Select a feature programmatically
    const options: PutEventStateOptions = {
    index: 0,
    state: 'click',
    mode: 'put', // Remove click state from other features
    show: true
    };

    // Add hover state without affecting others
    const hoverOptions: PutEventStateOptions = {
    index: 2,
    state: 'hover',
    mode: 'add', // Keep other hover states
    show: true
    };