Last active
December 2, 2021 03:51
-
-
Save KeesCBakker/5c80f7c470e0ce204e60b601f4cf3532 to your computer and use it in GitHub Desktop.
Custom Event Polyfill From MDN
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// custom event polyfill for IE9 - IE11 | |
(function () { | |
if (typeof window.CustomEvent !== 'function') { | |
function CustomEvent(event, params) { | |
params = params || { bubbles: false, cancelable: false, detail: undefined }; | |
var evt = document.createEvent('CustomEvent'); | |
evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail); | |
return evt; | |
} | |
CustomEvent.prototype = window.Event.prototype; | |
window.CustomEvent = CustomEvent; | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment