Skip to content

Instantly share code, notes, and snippets.

@KeesCBakker
Last active December 2, 2021 03:51
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KeesCBakker/5c80f7c470e0ce204e60b601f4cf3532 to your computer and use it in GitHub Desktop.
Save KeesCBakker/5c80f7c470e0ce204e60b601f4cf3532 to your computer and use it in GitHub Desktop.
Custom Event Polyfill From MDN
// 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