TemplateIfBinding
Describes a binding to Observable
created by the if
method.
Properties
-
attribute : string
readonlyinheritedmodule:ui/template~TemplateIfBinding#attribute
The name of the observed attribute.
-
callback : ( value: any, node: Node ) => TemplateSimpleValue | undefined
readonlyinheritedmodule:ui/template~TemplateIfBinding#callback
A custom function to process the value of the
attribute
. -
module:ui/template~TemplateIfBinding#emitter
An
Emitter
used 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 : Observable
readonlyinheritedmodule:ui/template~TemplateIfBinding#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.
-
valueIfTrue : string | undefined
readonlymodule:ui/template~TemplateIfBinding#valueIfTrue
The value of the DOM attribute or text to be set if the
attribute
inobservable
istrue
.
Methods
-
constructor( def )
module:ui/template~TemplateIfBinding#constructor
-
activateAttributeListener( schema, updater, data ) → () => void
inheritedmodule:ui/template~TemplateIfBinding#activateAttributeListener
Activates the listener which waits for changes of the
attribute
inobservable
, 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 : Updater
A DOM updater function used to update the native DOM attribute or text.
data : RenderData
Rendering data.
Returns
() => void
A function to sever the listener binding.
-
getValue( node ) → TemplateSimpleValue
module:ui/template~TemplateIfBinding#getValue
Returns the value of the binding. It is the value of the
attribute
inobservable
. The value may be processed by thecallback
, if such has been passed to the binding.Parameters
node : Node
A native DOM node, passed to the custom
callback
.
Returns
TemplateSimpleValue
The value of
attribute
inobservable
.