I need to fire an ErrorEvent
programmatically, but can't figure out how to initialize the properties of the event. The properties are readonly, and initEvent()
only initializes the event type, whether it bubbles, and if it's cancellable.
I tried
var myErrorEvent = new ErrorEvent("error", new Error("This is my error"));
and
myErrorEvent.initEvent("error", false, true, new Error("This is my error"));
or
// This function would be defined in IE only. Could not find it in Chrome.
myErrorEvent.initErrorEvent("error", false, true, "This is my error", "myfile.js", 1234);
I tried many other things, but could not get the properties of the ErrorEvent
to be set properly.
Is this even feasible?