TemplateIfBinding
Describes a binding to Observable created by the if method.
Properties
attribute : stringreadonlyinheritedmodule:ui/template~TemplateIfBinding#attributeThe name of the observed attribute.
callback : ( value: any, node: Node ) => TemplateSimpleValue | undefinedreadonlyinheritedmodule:ui/template~TemplateIfBinding#callbackA custom function to process the value of the
attribute.module:ui/template~TemplateIfBinding#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 : Observablereadonlyinheritedmodule:ui/template~TemplateIfBinding#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.
valueIfTrue : string | undefinedreadonlymodule:ui/template~TemplateIfBinding#valueIfTrueThe value of the DOM attribute or text to be set if the
attributeinobservableistrue.
Methods
constructor( def )module:ui/template~TemplateIfBinding#constructoractivateAttributeListener( schema, updater, data ) → () => voidinheritedmodule:ui/template~TemplateIfBinding#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~TemplateIfBinding#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.