delegate()
Delegates incoming events to methods of this object, notably from the attached view.
delegate(event: ObservableEvent): Promise<boolean | void> | boolean | void;
Notes
- This method is called automatically when an event is emitted by the current view object (except if ObservableEvent.noPropagation was set on the event; see ObservableObject.attach() which is used to set up view event delegation).
- The base implementation calls activity methods starting with
on, e.g.onClickfor aClickevent. The event is passed as a single argument, and the return value should either betrue(event handled), false/undefined, or a promise (which is awaited just to be able to handle any errors).
Parameters
- event — The event to be delegated
Return value
The result of the event handler method, or undefined.
Related
class Activity
A class that represents a part of the application that can be activated when the user navigates to it.attach() protected
Attaches the specified observable object to this object.interface ObservableObject.EventDelegate static
A type of object that can be used to handle events from other (attached) objects.
