TemplateBinding
Describes a binding created by the bind interface.
Properties
attribute : stringreadonlymodule:ui/template~TemplateBinding#attributeThe name of the observed attribute.
callback : ( value: any, node: Node ) => TemplateSimpleValue | undefinedreadonlymodule:ui/template~TemplateBinding#callbackA custom function to process the value of the
attribute.module:ui/template~TemplateBinding#emitterAn
Emitterused by the binding to:- listen to the attribute change in the
observable, - or listen to the event in the DOM.
- listen to the attribute change in the
observable : Observablereadonlymodule:ui/template~TemplateBinding#observableAn 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
constructor( def = { def.attribute, [def.callback], def.emitter, def.observable } )module:ui/template~TemplateBinding#constructorCreates an instance of the
TemplateBindingclass.Parameters
def : objectThe definition of the binding.
Propertiesdef.attribute : string[ def.callback ] : ( value: any, node: Node ) => TemplateSimpleValuedef.emitter : Emitterdef.observable : Observable
activateAttributeListener( schema, updater, data ) → () => voidmodule:ui/template~TemplateBinding#activateAttributeListenerActivates the listener which waits for changes of the
attributeinobservable, then updates the DOM with the aggregated value ofTemplateValueSchema.Parameters
schema : Array<TemplateSimpleValue | TemplateBinding>A full schema to generate an attribute or text in the DOM.
updater : UpdaterA DOM updater function used to update the native DOM attribute or text.
data : RenderDataRendering data.
Returns
() => voidA function to sever the listener binding.
getValue( node ) → TemplateSimpleValuemodule:ui/template~TemplateBinding#getValueReturns the value of the binding. It is the value of the
attributeinobservable. The value may be processed by thecallback, if such has been passed to the binding.Parameters
node : NodeA native DOM node, passed to the custom
callback.
Returns
TemplateSimpleValueThe value of
attributeinobservable.