gitlab-org--gitlab-foss/app/assets/javascripts/commons/polyfills/custom_event.js
2017-09-11 14:34:16 +00:00

14 lines
436 B
JavaScript

if (typeof window.CustomEvent !== 'function') {
window.CustomEvent = function CustomEvent(event, params) {
const evt = document.createEvent('CustomEvent');
const evtParams = {
bubbles: false,
cancelable: false,
detail: undefined,
...params,
};
evt.initCustomEvent(event, evtParams.bubbles, evtParams.cancelable, evtParams.detail);
return evt;
};
window.CustomEvent.prototype = Event;
}