@coveo/headless-react
    Preparing search index...

    Interface DictionaryFieldContext

    The DictionaryFieldContext controller allows specifying which dictionary field keys to retrieve.

    Example: dictionary-field-context.fn.ts

    interface DictionaryFieldContext {
        state: DictionaryFieldContextState;
        add(field: string, key: string): void;
        remove(field: string): void;
        set(context: DictionaryFieldContextPayload): void;
        subscribe(listener: () => void): Unsubscribe;
    }

    Hierarchy (View Summary)

    Index

    Methods

    Properties

    Methods

    • Adds (or, if one is already present, replaces) a new dictionary field context key-value pair.

      Parameters

      • field: string

        The dictionary field name.

      • key: string

        The dictionary field key for which to retrieve a value.

      Returns void

    • Removes a dictionary field from the query.

      Parameters

      • field: string

        The field to remove.

      Returns void

    • Sets the dictionary field context for the query. This replaces any existing context with the new one.

      Parameters

      Returns void

    • Adds a callback that's invoked on state change.

      Parameters

      • listener: () => void

        A callback that's invoked on state change.

      Returns Unsubscribe

      A function to remove the listener.

    Properties

    The state of the DictionaryFieldContext controller.