DynCompareFn<T>: {
    subscribe?: ((handler) => (() => void));
    (a, b): number;
}

A callback function that compares two values. Return > 0 to sort 'b' before 'a'; < 0 to sort 'a' before 'b'; or 0 to keep original order of 'a' & 'b'.

This function has an optional subscribe function that follows the Svelte store Subscriber pattern. If a subscribe function is provided automatic updates to the reduced index is performed.

Type Parameters

  • T

Type declaration

    • (a, b): number
    • Parameters

      • a: T

        Element 'a' of backing data to sort.

      • b: T

        Element 'b' of backing data to sort.

      Returns number

  • Optional subscribe?: ((handler) => (() => void))

    Param: handler

    Callback function that is invoked on update / changes. Receives this reference.

      • (handler): (() => void)
      • Parameters

        • handler: ((value) => void)

          Callback function that is invoked on update / changes. Receives this reference.

            • (value): void
            • Parameters

              • value: any

              Returns void

        Returns (() => void)

          • (): void
          • Returns void