Choices/src/scripts/src/lib/polyfills.js

19 lines
521 B
JavaScript
Raw Normal View History

2018-05-25 09:44:54 +02:00
import 'core-js/fn/array/from';
import 'core-js/fn/array/find';
2016-07-11 16:27:58 +02:00
2018-05-25 09:44:54 +02:00
(function CustomEventPolyfill() {
if (typeof window.CustomEvent === 'function') {
return false;
2017-01-01 16:32:09 +01:00
}
2018-05-25 09:44:54 +02:00
function CustomEvent (event, params = { bubbles: false, cancelable: false, detail: undefined }) {
const evt = document.createEvent('CustomEvent');
2017-01-01 16:32:09 +01:00
evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);
return evt;
2017-08-16 10:47:22 +02:00
}
2017-01-01 16:32:09 +01:00
CustomEvent.prototype = window.Event.prototype;
window.CustomEvent = CustomEvent;
2017-08-16 10:47:22 +02:00
}());