on( )


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:

Copy
1

In Velo Implementation:

Copy
1
Method Declaration
Copy
Method Parameters
eventNamestringRequired

The name of the event.


callBackFunctionFunctionRequired

The callback function to run when the event is triggered.

Was this helpful?
Yes
No