Registers a callback function in Velo for an event triggered from the custom element.
The on()
function registers a callback function in Velo based on the this.dispatchEvent()
in the custom element's script.
The on()
function enables the custom element to affect the rendering of the site.
The code snippets below demonstrate how to define a my-event
event in the custom element's implementation and how to refer to it from Velo.
In Custom Element Implementation:
In Velo Implementation:
The name of the event.
The callback function to run when the event is triggered.