-
Notifications
You must be signed in to change notification settings - Fork 0
Event Methods
The events method can group multiple different events under one umbrella.
types
Event types work like the first parameter you would pass into an event listener method in vanilla JavaScript. You can group multiple events in one call.
// vanilla JS
document.addEventListener("click", clickEvent);
// Xenium
x().events("click", (e, t) => {});
// grouping multiple events
x().events("click, mousemove, mousedown", (e, t) => {});
types: string
The type of events to perform
callback: function
The callback function can take 2 parameters, the e
parameter is the event object.
The event object has a couple of extra methods added to it.
See below documentation of e.isTarget() and e.isEvent()
Returns - void
The is target method checks to see if the clicked target contains the class or id that was passed into the isTarget method.
identifier: string
The selector identifier of the event target
callback: function
If the identifier has been found this callback function will execute. If this method is not used this method will return a boolean value.
Returns - boolean or void
Executes if the type of event performed is the same as the type of event passed into the isEvent method.
eventType: string
The event type to check for.
callback: function
If the event type has been found this callback function will execute. If this method is not used this method will return a boolean value.
Returns - boolean or void