+ 5
how i can make a event
i want make a custom event i making a game and want when my shape moved a event run and to inform other funections on shape new location thanks again for your Attention
5 Answers
+ 1
u can create custom with the "Event" constructor like this :
var event = new Event('myEvent');
// Listen for the event on ur prefered element
elem.addEventListener('myEvent', function (e) {
//ur code
}, false);
// Finally Dispatch the event.
elem.dispatchEvent(event)
+ 12
Refer W3school for Javascript Events-
https://www.w3schools.com/js/js_events.asp
+ 4
no i want make a custom event
i making a game and want when my shape moved a event run and to inform other funections on shape new location
thanks again for your Attention
+ 3
thanks bro
+ 2
hey ! take a look at my code ! thats a javascript event
https://code.sololearn.com/WRcNDKdQpst4/#html