Welcome to mirror list, hosted at ThFree Co, Russian Federation.

custom_event.js « polyfills « commons « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 6b14eff6f0569ba6f312259efc7654d59524e641 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/**
 * Polyfill: CustomEvent constructor
 * @what new CustomEvent()
 * @why Certain features, e.g. notes utilize this
 * @browsers Internet Explorer 11
 * @see https://caniuse.com/#feat=customevent
 */
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;
}