41 });
42 };
43 try {
44 new Event("test"); 45 } catch (e) {
46 createEvent = function createEvent2(name) {
47 var evt = document.createEvent("Event");
8697 return new Event(e2, { bubbles: true });
8698 };
8699 try {
8700 new Event("test"); 8701 } catch (e2) {
8702 o = function(e3) {
8703 var t2 = document.createEvent("Event");
Class constructors being invoked and then dropped immediately is an anti-pattern and should be avoided.
Objects instantiated with new
should always be useful in some way (passed as a function argument, stored in a variable for later use, etc).
If the object is instantiated only to invoke some side effect in the constructor, then the side effect should be refactored out into it's own function.
new Foo()
const myFoo = new Foo()