2020-04-08 14:13:33 +05:30
|
|
|
/**
|
|
|
|
* Polyfill: CustomEvent constructor
|
|
|
|
* @what new CustomEvent()
|
|
|
|
* @why Certain features, e.g. notes utilize this
|
|
|
|
* @browsers Internet Explorer 11
|
|
|
|
* @see https://caniuse.com/#feat=customevent
|
|
|
|
*/
|
2017-08-17 22:00:37 +05:30
|
|
|
if (typeof window.CustomEvent !== 'function') {
|
|
|
|
window.CustomEvent = function CustomEvent(event, params) {
|
|
|
|
const evt = document.createEvent('CustomEvent');
|
2018-03-17 18:26:18 +05:30
|
|
|
const evtParams = {
|
|
|
|
bubbles: false,
|
|
|
|
cancelable: false,
|
|
|
|
detail: undefined,
|
|
|
|
...params,
|
|
|
|
};
|
2017-08-17 22:00:37 +05:30
|
|
|
evt.initCustomEvent(event, evtParams.bubbles, evtParams.cancelable, evtParams.detail);
|
|
|
|
return evt;
|
|
|
|
};
|
|
|
|
window.CustomEvent.prototype = Event;
|
|
|
|
}
|