Support Menu

Class Initialization

The main purpose of this class is to initialize the framework (a.k.a the code executed when calling Coveo.init).
It's also in charge or registering the available components, as well as the method that we expost to the global Coveo scope.
For example, the Coveo.executeQuery function will be registed in this class by the QueryController.

Index

Methods

Static automaticallyCreateComponentsInside

  • automaticallyCreateComponentsInside(element: HTMLElement, initParameters: IInitializationParameters, ignore?: string[]): void
  • Scan the element and all its children for known components. Initialize every known component found.

    Parameters

    • element: HTMLElement

      The element for which to scan it's children.

    • initParameters: IInitializationParameters

      Needed parameters to initialize all the children components.

    • Optional ignore: string[]

      An optional list of component ID to ignore and skip when scanning for known components.

    Returns void

Static createComponentOfThisClassOnElement

  • Create a new component on the given element.

    Parameters

    • componentClassId: string

      The ID of the component to initialize (e.g. : 'CoveoFacet').

    • element: HTMLElement

      The HTMLElement on which to initialize.

    • Optional initParameters: IInitializationParameters

      Needed parameters to initialize the component.

    Returns Component

Static getListOfRegisteredComponents

  • getListOfRegisteredComponents(): unknown

Static getRegisteredComponent

  • getRegisteredComponent(name: string): any

Static initRecommendationInterface

  • initRecommendationInterface(element: HTMLElement, options?: any): void
  • Create a new recommendation search interface. This is the function executed when calling Coveo.initRecommendation.

    Parameters

    • element: HTMLElement
    • Default value options: any = {}

    Returns void

Static initSearchInterface

  • initSearchInterface(element: HTMLElement, options?: any): void
  • Create a new standard search interface. This is the function executed when calling Coveo.init.

    Parameters

    • element: HTMLElement
    • Default value options: any = {}

    Returns void

Static initStandaloneSearchInterface

  • initStandaloneSearchInterface(element: HTMLElement, options?: any): void
  • Create a new standalone search interface (standalone search box). This is the function executed when calling Coveo.initSearchbox.

    Parameters

    • element: HTMLElement
    • Default value options: any = {}

    Returns void

Static initializeFramework

  • initializeFramework(element: HTMLElement, options?: any, initSearchInterfaceFunction?: function): void
  • Initialize the framework. Note that this function should not normally be called directly, but instead using a globally registered function (e.g.: Coveo.init), or Initialization.initSearchInterface or Initialization.initStandaloneSearchInterface
    (e.g. : Coveo.init or Coveo.initSearchbox).

    Parameters

    • element: HTMLElement

      The element on which to initialize the interface.

    • Optional options: any

      The options for all components (eg: {Searchbox : {enableSearchAsYouType : true}}).

    • Optional initSearchInterfaceFunction: function

      The function to execute to create the SearchInterface component. Different init call will create different SearchInterface.

        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns void

Static isComponentClassIdRegistered

  • isComponentClassIdRegistered(componentClassId: string): boolean
  • Check if a component is already registed, using it's ID (e.g. : 'Facet').

    Parameters

    • componentClassId: string

    Returns boolean

Static isNamedMethodRegistered

  • isNamedMethodRegistered(methodName: string): boolean

Static monkeyPatchComponentMethod

  • monkeyPatchComponentMethod(methodName: string, element: HTMLElement, handler: function): void
  • 'Monkey patch' (replace the function with a new one) a given method on a component instance.

    Parameters

    • methodName: string
    • element: HTMLElement
    • handler: function
        • (...args: any[]): any
        • Parameters

          • Rest ...args: any[]

          Returns any

    Returns void

Static registerAutoCreateComponent

  • Register a new Component to be recognized by the framework.
    This essentially mean that when we call Coveo.init, the Initialization class will scan the DOM for known component (which have registed themselves with this call) and create a new component on each element.

    Parameters

    Returns void

Static registerDefaultOptions

  • registerDefaultOptions(element: HTMLElement, options: object): void
  • Register a new set of options for a given element.
    When the element is eventually initialized as a component, those options will be used / merged to create the final option set to use for this component.
    Note that this function should not normally be called directly, but instead using the global Coveo.options function

    Parameters

    • element: HTMLElement
    • options: object

    Returns void

Static registerNamedMethod

  • registerNamedMethod(methodName: string, handler: function): void
  • Register a new globally available method in the Coveo namespace (e.g.: Coveo.init).

    Parameters

    • methodName: string

      The method name to register.

    • handler: function

      The function to execute when the method is called.

        • (element: HTMLElement, ...args: any[]): any
        • Parameters

          • element: HTMLElement
          • Rest ...args: any[]

          Returns any

    Returns void

Hierarchy

  • Initialization