I have a working script from someone, there in is this line:
this.event = document.createEvent('Event');
When i look up documentation i always see a few possibilities listed to use, like mouseEvent, ‘Event’ is never listed.
Is ‘Event’ a real event? Or is it not?
And he has:
this.event = document.createEvent('Event');
this.event.initEvent('shake', true, true);
I want to be able to trigger 4 different event’s back.
Is this the proper way?
this.event1 = document.createEvent('Event');
this.event1.initEvent('betaAwayTick', true, true);
this.event2 = document.createEvent('Event');
this.event2.initEvent('betaAwayHold', true, true);
this.event3 = document.createEvent('Event');
this.event3.initEvent('betaTowardsTick', true, true);
this.event4 = document.createEvent('Event');
this.event4.initEvent('betaTowardsHold', true, true);
Or is this overkill?
All the other event types implement/inherit the
Eventinterface. See the specification.MDN also lists it in the list of DOM 3 events: