bind

fun bind(accessor: (elementId: String) -> String, updateOnEvent: String, initialValue: JsonElement = JsonPrimitive("")): KVar<JsonElement>(source)

Return a KVar that is tied to a property related to an element, which will update when an specified event fires on this element. This is a convenience wrapper around bind.

Parameters

accessor

Function that takes an element id and returns a JavaScript expression to access that element

updateOnEvent

The event to listen for that signifies this element has been updated

initialValue

The initial value of the KVar


fun bind(reader: (elementId: String) -> String, writer: (elementId: String, value: String) -> String, updateOnEvent: String, initialValue: JsonElement = JsonPrimitive("")): KVar<JsonElement>(source)

Return a KVar that is tied to a property related to an element, which will update when an specified event fires on this element.

Parameters

reader

Function that takes an element id and returns a JavaScript expression to read that element

writer

Function that takes an element id and a new value, and returns a JavaScript expression to write that value.

updateOnEvent

The event to listen for that signifies this element has been updated

initialValue

The initial value of the KVar