Merge pull request #382 from Jyyjy/event_type

Changed event constructor for node.js 19+
diff --git a/test/sendLogs_spec.js b/test/sendLogs_spec.js
index cb64bcf..35686e6 100644
--- a/test/sendLogs_spec.js
+++ b/test/sendLogs_spec.js
@@ -97,7 +97,7 @@
         };
         sendOnClose([], {on: true, url: 'test'})
         sendOnClose([{foo: 'bar'}], {on: true, url: 'test'});
-        global.window.dispatchEvent(new CustomEvent('pagehide'))
+        global.window.dispatchEvent(new window.CustomEvent('pagehide'))
         sinon.assert.calledOnce(sendBeaconSpy)
     });
 
@@ -107,7 +107,7 @@
             sendBeacon: sendBeaconSpy
         };
         sendOnClose([{foo: 'bar'}], {on: false, url: 'test'});
-        global.window.dispatchEvent(new CustomEvent('pagehide'))
+        global.window.dispatchEvent(new window.CustomEvent('pagehide'))
         sinon.assert.notCalled(sendBeaconSpy)
     });
 });