|
1 |
| -// IE11 polyfills |
2 |
| - |
3 |
| -import ownKeys from 'reflect.ownkeys' |
4 |
| - |
5 |
| -const reduce = Function.bind.call(Function.call, Array.prototype.reduce); |
6 |
| -const isEnumerable = Function.bind.call(Function.call, Object.prototype.propertyIsEnumerable); |
7 |
| -const concat = Function.bind.call(Function.call, Array.prototype.concat); |
8 |
| - |
9 |
| -if (!Object.values) { |
10 |
| - Object.values = function values(O) { |
11 |
| - return reduce(ownKeys(O), (v, k) => concat(v, typeof k === 'string' && isEnumerable(O, k) ? [O[k]] : []), []); |
12 |
| - }; |
13 |
| -} |
14 |
| - |
15 |
| -if (!Object.entries) { |
16 |
| - Object.entries = function entries(O) { |
17 |
| - return reduce(ownKeys(O), (e, k) => concat(e, typeof k === 'string' && isEnumerable(O, k) ? [[k, O[k]]] : []), []); |
18 |
| - }; |
19 |
| -} |
20 |
| - |
21 |
| -if (!Array.prototype.find) { |
22 |
| - Array.prototype.find = function(predicate) { |
23 |
| - if (this == null) { |
24 |
| - throw new TypeError('Array.prototype.find called on null or undefined'); |
25 |
| - } |
26 |
| - if (typeof predicate !== 'function') { |
27 |
| - throw new TypeError('predicate must be a function'); |
28 |
| - } |
29 |
| - const list = Object(this); |
30 |
| - const length = list.length >>> 0; |
31 |
| - const thisArg = arguments[1]; |
32 |
| - let value; |
33 |
| - |
34 |
| - for (let i = 0; i < length; i++) { |
35 |
| - value = list[i]; |
36 |
| - if (predicate.call(thisArg, value, i, list)) { |
37 |
| - return value; |
38 |
| - } |
39 |
| - } |
40 |
| - return undefined; |
41 |
| - }; |
42 |
| -} |
| 1 | +/* |
| 2 | +* required polyfills |
| 3 | +*/ |
| 4 | + |
| 5 | +/** IE9, IE10 and IE11 requires all of the following polyfills. **/ |
| 6 | +// import 'core-js/es6/symbol' |
| 7 | +// import 'core-js/es6/object' |
| 8 | +// import 'core-js/es6/function' |
| 9 | +// import 'core-js/es6/parse-int' |
| 10 | +// import 'core-js/es6/parse-float' |
| 11 | +// import 'core-js/es6/number' |
| 12 | +// import 'core-js/es6/math' |
| 13 | +// import 'core-js/es6/string' |
| 14 | +// import 'core-js/es6/date' |
| 15 | +import 'core-js/es6/array' |
| 16 | +// import 'core-js/es6/regexp' |
| 17 | +import 'core-js/es6/map' |
| 18 | +// import 'core-js/es6/weak-map' |
| 19 | +import 'core-js/es6/set' |
| 20 | +import 'core-js/es7/object' |
| 21 | + |
| 22 | +/** IE10 and IE11 requires the following for the Reflect API. */ |
| 23 | +// import 'core-js/es6/reflect' |
| 24 | + |
| 25 | +/** Evergreen browsers require these. **/ |
| 26 | +// Used for reflect-metadata in JIT. If you use AOT (and only Angular decorators), you can remove. |
| 27 | +// import 'core-js/es7/reflect' |
| 28 | + |
| 29 | + |
| 30 | + |
| 31 | +// CustomEvent() constructor functionality in IE9, IE10, IE11 |
| 32 | +(function () { |
| 33 | + |
| 34 | + if ( typeof window.CustomEvent === "function" ) return false |
| 35 | + |
| 36 | + function CustomEvent ( event, params ) { |
| 37 | + params = params || { bubbles: false, cancelable: false, detail: undefined } |
| 38 | + var evt = document.createEvent( 'CustomEvent' ) |
| 39 | + evt.initCustomEvent( event, params.bubbles, params.cancelable, params.detail ) |
| 40 | + return evt |
| 41 | + } |
| 42 | + |
| 43 | + CustomEvent.prototype = window.Event.prototype |
| 44 | + |
| 45 | + window.CustomEvent = CustomEvent |
| 46 | +})() |
0 commit comments