Trilium Frontend API
    Preparing search index...

    Type Alias FacetConfig<Input, Output>

    type FacetConfig<Input, Output> = {
        combine?: (value: readonly Input[]) => Output;
        compare?: (a: Output, b: Output) => boolean;
        compareInput?: (a: Input, b: Input) => boolean;
        enables?: Extension | ((self: Facet<Input, Output>) => Extension);
        static?: boolean;
    }

    Type Parameters

    • Input
    • Output
    Index

    Properties

    combine?: (value: readonly Input[]) => Output

    How to combine the input values into a single output value. When not given, the array of input values becomes the output. This function will immediately be called on creating the facet, with an empty array, to compute the facet's default value when no inputs are present.

    compare?: (a: Output, b: Output) => boolean

    How to compare output values to determine whether the value of the facet changed. Defaults to comparing by === or, if no combine function was given, comparing each element of the array with ===.

    compareInput?: (a: Input, b: Input) => boolean

    How to compare input values to avoid recomputing the output value when no inputs changed. Defaults to comparing with ===.

    enables?: Extension | ((self: Facet<Input, Output>) => Extension)

    If given, these extension(s) (or the result of calling the given function with the facet) will be added to any state where this facet is provided. (Note that, while a facet's default value can be read from a state even if the facet wasn't present in the state at all, these extensions won't be added in that situation.)

    static?: boolean

    Forbids dynamic inputs to this facet.