Trilium Frontend API
    Preparing search index...

    Class TemplateToBindingInternal

    Describes either:

    • a binding to an module:utils/observablemixin~Observable,
    • or a native DOM event binding.

    It is created by the module:ui/template~BindChain#to method.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    attribute: string

    The name of the module:ui/template~TemplateBinding#observable observed attribute.

    callback?: (value: any, node: Node) => TemplateSimpleValue

    A custom function to process the value of the module:ui/template~TemplateBinding#attribute.

    emitter: Emitter

    An module:utils/emittermixin~Emitter used by the binding to:

    • listen to the attribute change in the module:ui/template~TemplateBinding#observable,
    • or listen to the event in the DOM.
    eventNameOrFunction: string | ((domEvent: Event) => void)
    observable: Observable

    An observable instance of the binding. It either:

    • provides the attribute with the value,
    • or passes the event when a corresponding DOM event is fired.

    Methods

    • Activates the listener which waits for changes of the module:ui/template~TemplateBinding#attribute in module:ui/template~TemplateBinding#observable, then updates the DOM with the aggregated value of module:ui/template~TemplateValueSchema.

      Parameters

      Returns () => void

      A function to sever the listener binding.

    • Activates the listener for the native DOM event, which when fired, is propagated by the module:ui/template~TemplateBinding#emitter.

      Parameters

      • domEvtName: string

        The name of the native DOM event.

      • domSelector: string

        The selector in the DOM to filter delegated events.

      • data: { node: any }

        Rendering data.

      Returns () => void

      A function to sever the listener binding.

    • Returns the value of the binding. It is the value of the module:ui/template~TemplateBinding#attribute in module:ui/template~TemplateBinding#observable. The value may be processed by the module:ui/template~TemplateBinding#callback, if such has been passed to the binding.

      Parameters

      • node: Node

        A native DOM node, passed to the custom module:ui/template~TemplateBinding#callback.

      Returns TemplateSimpleValue

      The value of module:ui/template~TemplateBinding#attribute in module:ui/template~TemplateBinding#observable.