The Sort controller manages how the results are sorted.

Example: sort.fn.tsx

interface Sort {
    state: SortState;
    isSortedBy(criterion: SortCriterion | SortCriterion[]): boolean;
    sortBy(criterion: SortCriterion | SortCriterion[]): void;
    subscribe(listener: () => void): Unsubscribe;
}

Hierarchy (View Summary)

Methods

Properties

Methods

  • Verifies whether the specified sort criterion is the currently active one.

    Parameters

    Returns boolean

    true if the specified sort criterion is the currently active one; false otherwise.

  • Updates the sort criterion and executes a new search.

    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

state: SortState

A scoped and simplified part of the headless state that is relevant to the Sort controller.