summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/commons/polyfills/custom_event.js
blob: 8fd41fdd8dcfbda544ff630d94effb35d686db94 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
if (typeof window.CustomEvent !== 'function') {
  window.CustomEvent = function CustomEvent(event, params) {
    const evt = document.createEvent('CustomEvent');
    const evtParams = Object.assign({}, params, {
      bubbles: false,
      cancelable: false,
      detail: undefined,
    });
    evt.initCustomEvent(event, evtParams.bubbles, evtParams.cancelable, evtParams.detail);
    return evt;
  };
  window.CustomEvent.prototype = Event;
}