initEvent
initEvent is a method on Event objects used to initialize or reinitialize the properties of an Event created with document.createEvent in legacy web APIs. It is part of the older DOM Events interface and is kept for backward compatibility in some environments.
Its signature is initEvent(type, bubbles, cancelable) and it sets the event’s type, the boolean for whether the
In modern web development, initEvent is deprecated and may not be supported in all environments. The recommended
var e = document.createEvent('Event');
e.initEvent('build', true, true);
var e = new Event('build', { bubbles: true, cancelable: true });
See also: Event interface, CustomEvent, dispatchEvent, and the modern event construction pattern.