@coveo/headless
    Preparing search index...

    Interface Relay

    Relay instance. This object provides a comprehensive set of variables and methods for interacting with the Event API.

    interface Relay {
        emit: (type: string, payload: Record<string, any>) => void;
        getMeta: (type: string) => Meta;
        off: (type: string, callback?: any) => void;
        on: (type: string, callback: EventCallback) => Off;
        updateConfig: (config: RelayConfig) => void;
        version: string;
    }
    Index

    Properties

    emit: (type: string, payload: Record<string, any>) => void

    Sends an event to the Event API.

    Type declaration

      • (type: string, payload: Record<string, any>): void
      • Parameters

        • type: string

          event's type to be emitted.

        • payload: Record<string, any>

          payload to include within the event.

        Returns void

    getMeta: (type: string) => Meta

    Gets the client-side generated meta object.

    Type declaration

      • (type: string): Meta
      • Parameters

        • type: string

          event's type that will be included in the meta object.

        Returns Meta

    off: (type: string, callback?: any) => void

    Detach callback(s) from events. If only the "type" parameter is set, all callbacks for the specified type will be removed.

    Type declaration

      • (type: string, callback?: any): void
      • Parameters

        • type: string

          event's type.

        • Optionalcallback: any

          callback that should be removed.

        Returns void

    on: (type: string, callback: EventCallback) => Off

    Attaches an event callback to either all event types or a specific one. The callback set will be called when an event with the specified type is emitted. It’s not possible to modify the payload of the event sent to Coveo using this listener. Setting type as "*" will trigger the callback for all event types. Returns the "off" function to detach the event callback.

    Type declaration

      • (type: string, callback: EventCallback): Off
      • Parameters

        • type: string

          event's type.

        • callback: EventCallback

          callback that should be called when the event is emitted.

        Returns Off

    updateConfig: (config: RelayConfig) => void

    Updates Relay's configuration after its initialization.

    Type declaration

      • (config: RelayConfig): void
      • Parameters

        • config: RelayConfig

          configuration that should be updated.

        Returns void

    version: string

    Current version of the Relay library.