UNPKG

603 BJavaScriptView Raw
1(() => {
2 if (typeof window !== 'object' || typeof window.CustomEvent === 'function')
3 return;
4
5 const CustomEvent = (event, params) => {
6 params = params || { bubbles: false, cancelable: false, detail: null };
7 let evt = document.createEvent('CustomEvent');
8 evt.initCustomEvent(
9 event,
10 params.bubbles,
11 params.cancelable,
12 params.detail,
13 );
14 return evt;
15 };
16
17 window.CustomEvent = CustomEvent;
18})();
19
20(() => {
21 if (typeof Object.values === 'function') return;
22
23 const values = (O) => Object.keys(O).map((key) => O[key]);
24
25 Object.values = values;
26})();