Interface ResultTemplatesManager<Content, LinkContent>

interface ResultTemplatesManager<Content = unknown, LinkContent = unknown> {
    registerTemplates(...newTemplates: ResultTemplate<Content>[]): void;
    selectLinkTemplate(result: Result): null | LinkContent;
    selectTemplate(result: Result): null | Content;
}

Type Parameters

  • Content = unknown
  • LinkContent = unknown

Methods

  • Registers any number of result templates in the manager.

    Parameters

    Returns void

  • Selects the highest priority link template for which the given result satisfies all conditions. In the case where satisfied templates have equal priority, the template that was registered first is returned.

    Parameters

    • result: Result

      (Result) The result for which to select a template.

    Returns null | LinkContent

    (Content) The selected template's content, or null if no template's conditions are satisfied.

  • Selects the highest priority template for which the given result satisfies all conditions. In the case where satisfied templates have equal priority, the template that was registered first is returned.

    Parameters

    • result: Result

      (Result) The result for which to select a template.

    Returns null | Content

    (Content) The selected template's content, or null if no template's conditions are satisfied.