All components trigger events that can be used to perform additional actions.
They can be used in three ways:
When creating an instance of a component, you can pass an on
option, which takes an object with event handlers.
Also, in this method, you can use a general any
handler, which will be called for all events.
After creating an instance of the component, you can add an event handler directly on the instance itself.
After creating an instance of the component, you can add an event handler directly to the element itself.
By default, events that are listened to directly through an element have the prefix 'ui-{component}:'
. This can be changed by the eventPrefix
property.
Events dispach can be disabled by setting eventDispatch
to false
:
The any
and breakpoint
events are not generated on the element.
This method is similar to the previous one, but the handler is added to the document. In this case, it will be called for all components.
If it is necessary to handle an event only for a specific component, you can check its id:
Events bubbling can be disabled by setting eventBubble
to false
: