Events API
evt.run()
asyncTriggers the event from the "events" folder, along with any new events created.
-
Accepts the event name as a string, as the first argument.
Accepts any number of optional arguments, which will be passed to the event, starting with the second argument. - The events to be triggered must be globally enabled in the "events" property of the "config.js" configuration file, e.g., "$click: true".
- It is not necessary to wait for the method to be executed using await if not needed.
Example:
// Triggers the "click" event with the passed argument.
evt.run('click', {target: null});
// Triggers the "customEvent" event with the passed arguments.
evt.run('customEvent', 'book', 'cat');
// Triggers the "customEvent" event without any arguments.
evt.run('customEvent');
// Waiting for the event to complete.
await evt.run('customEvent');