BigW Consortium Gitlab

custom_event.js 436 Bytes
Newer Older
1 2 3
if (typeof window.CustomEvent !== 'function') {
  window.CustomEvent = function CustomEvent(event, params) {
    const evt = document.createEvent('CustomEvent');
4 5 6 7 8 9
    const evtParams = {
      bubbles: false,
      cancelable: false,
      detail: undefined,
      ...params,
    };
10 11 12 13 14
    evt.initCustomEvent(event, evtParams.bubbles, evtParams.cancelable, evtParams.detail);
    return evt;
  };
  window.CustomEvent.prototype = Event;
}