Utils
Event Dispatcher
arguments:
host
- element instanceeventType
- type of the event to be dispatchedoptions
- a dictionary, having the following optional fields:bubbles
- a boolean indicating whether the event bubbles. The default is falsecancelable
- a boolean indicating whether the event can be cancelled. The default is falsecomposed
- a boolean indicating whether the event will trigger listeners outside of a shadow root The default is falsedetail
- a custom data, which will be passed to an event listener
returns:
false
if event is cancelable and at least one of the event handlers which handled this event calledpreventDefault()
, otherwise it returnstrue
dispatch
is a helper function, which simplifies event dispatch on element instance. It creates CustomEvent
with set options
and dispatches it on given host
element.
For example, it can be used to dispatch change
event and notify a user of the custom element, that value has changed:
Last updated
Was this helpful?