+ 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

18th Aug 2017, 1:19 PM
amirhosein bidar
amirhosein bidar - avatar
5 Respostas
+ 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)
5th Oct 2017, 12:53 PM
Saeed Soltani
Saeed Soltani - avatar
+ 12
Refer W3school for Javascript Events- https://www.w3schools.com/js/js_events.asp
18th Aug 2017, 1:55 PM
Apoorva Shenoy Nayak
Apoorva Shenoy Nayak - avatar
+ 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
18th Aug 2017, 4:54 PM
amirhosein bidar
amirhosein bidar - avatar
+ 3
thanks bro
5th Oct 2017, 12:55 PM
amirhosein bidar
amirhosein bidar - avatar
+ 2
hey ! take a look at my code ! thats a javascript event https://code.sololearn.com/WRcNDKdQpst4/#html
18th Aug 2017, 1:29 PM
Carlos Castro
Carlos Castro - avatar