Docs (4.0.0)
class View method

applyViewPreset

Applies the provided preset properties to this object.

applyViewPreset(preset: {}): void

Summary

This method is called from the constructor of preset view classes, e.g. the result of ui.label(...) and ViewComposite.withPreset(). The provided object may contain property values, bindings, and event specifiers.

Property values — These are set directly on the view object. Each property is set to the corresponding value.

Bindings — These are applied on properties the view object. Each property may be bound using an instance of the Binding class (i.e. the result of bound() functions), creating the target property and taking effect immediately.

Events — Events can be handled in two ways, depending on the value of the on... property:

  • onClick: "RemoveItem" — this intercepts Click events and emits RemoveItem events instead. The ManagedEvent.inner property is set to the original Click event.
  • onClick: "+RemoveItem" — this intercepts Click events and emits both the original Click event as well as a new RemoveItem event. The ManagedEvent.inner property of the second event refers to the original Click event.

Note
This method is called automatically. Do not call this method after constructing a view object.

Related

  • class View abstractAn abstract class that represents a view.