TemplateToBinding (ui)
@ckeditor/ckeditor5-ui/src/template
Describes either:
- a binding to an
Observable
, - or a native DOM event binding.
It is created by the to
method.
Filtering
Properties
-
The name of the observed attribute.
-
readonly inherited
callback : ( any, Node ) => TemplateSimpleValue | undefined
module:ui/template~TemplateToBinding#callback
A custom function to process the value of the
attribute
. -
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
-
readonly
eventNameOrFunction : string | ( Event ) => void
module:ui/template~TemplateToBinding#eventNameOrFunction
-
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
-
constructor( def )
module:ui/template~TemplateToBinding#constructor
-
inherited
activateAttributeListener( schema, updater, data ) → () => void
module:ui/template~TemplateToBinding#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.
-
activateDomEventListener( domEvtName, domSelector, data = { data.node } ) → () => void
module:ui/template~TemplateToBinding#activateDomEventListener
Activates the listener for the native DOM event, which when fired, is propagated by the
emitter
.Parameters
domEvtName : string
The name of the native DOM event.
domSelector : string
The selector in the DOM to filter delegated events.
data : object
Rendering data.
Propertiesdata.node : any
Returns
() => void
A function to sever the listener binding.
-
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
.
Every day, we work hard to keep our documentation complete. Have you spotted outdated information? Is something missing? Please report it via our issue tracker.
With the release of version 42.0.0, we have rewritten much of our documentation to reflect the new import paths and features. We appreciate your feedback to help us ensure its accuracy and completeness.