-
Notifications
You must be signed in to change notification settings - Fork 0
Events
Milos Stanojevic edited this page Mar 14, 2020
·
2 revisions
Adding events to Supercharge elements is very easy. You can simply create a method with the corresponding name and Supercharge.js will automatically bind the events for you.
class Button extends Supercharge {
onClick(e) {
alert('Button clicked!');
}
}You can do the same using the factory. Simply add a property with the event name and the factory will do the rest.
let app = SuperchargeFactory.build({
...
'onClick': function (e) {
alert('Mouse Coordinates: ' + e.clientX + ' , ' + e.clientY);
}
...
});