polyfills.ts 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. /**
  2. * This file includes polyfills needed by Angular and is loaded before the app.
  3. * You can add your own extra polyfills to this file.
  4. *
  5. * This file is divided into 2 sections:
  6. * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
  7. * 2. Application imports. Files imported after ZoneJS that should be loaded before your main
  8. * file.
  9. *
  10. * The current setup is for so-called "evergreen" browsers; the last versions of browsers that
  11. * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),
  12. * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.
  13. *
  14. * Learn more in https://angular.io/guide/browser-support
  15. */
  16. // (function () {
  17. // Object.setPrototypeOf = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array ? setProtoOf : mixinProperties);
  18. // function setProtoOf(obj, proto) {
  19. // obj.__proto__ = proto;
  20. // return obj;
  21. // }
  22. // function mixinProperties(obj, proto) {
  23. // for (const prop in proto) {
  24. // if (!obj.hasOwnProperty(prop)) {
  25. // obj[prop] = proto[prop];
  26. // }
  27. // }
  28. // return obj;
  29. // }
  30. // })();
  31. // // This polyfill adds compatibility to all Browsers supporting ES5:
  32. // if ((window as any).NodeList && !NodeList.prototype.forEach) {
  33. // NodeList.prototype.forEach = function (callback, thisArg) {
  34. // thisArg = thisArg || window;
  35. // for (let i = 0; i < this.length; i++) {
  36. // callback.call(thisArg, this[i], i, this);
  37. // }
  38. // };
  39. // }
  40. // // 解决ie下报错 对象不支持matches
  41. // if (!Element.prototype.matches) {
  42. // Element.prototype.matches =
  43. // (Element.prototype as any).matchesSelector ||
  44. // (Element.prototype as any).mozMatchesSelector ||
  45. // (Element.prototype as any).msMatchesSelector ||
  46. // (Element.prototype as any).oMatchesSelector ||
  47. // Element.prototype.webkitMatchesSelector ||
  48. // function (s) {
  49. // const matches = (this.document || this.ownerDocument).querySelectorAll(s);
  50. // let i = matches.length;
  51. // while (--i >= 0 && matches.item(i) !== this) { }
  52. // return i > -1;
  53. // };
  54. // }
  55. // if (!('classList' in document.documentElement)) {
  56. // Object.defineProperty(HTMLElement.prototype, 'classList', {
  57. // get: function () {
  58. // var self = this;
  59. // function update(fn) {
  60. // return function (value) {
  61. // var classes = self.className.split(/\s+/g);
  62. // var index = classes.indexOf(value);
  63. // fn(classes, index, value);
  64. // self.className = classes.join(' ');
  65. // };
  66. // }
  67. // return {
  68. // add: update(function (classes, index, value) {
  69. // if (!~index) classes.push(value);
  70. // }),
  71. // remove: update(function (classes, index) {
  72. // if (~index) classes.splice(index, 1);
  73. // }),
  74. // toggle: update(function (classes, index, value) {
  75. // if (~index) { classes.splice(index, 1); } else { classes.push(value); }
  76. // }),
  77. // contains: function (value) {
  78. // return !!~self.className.split(/\s+/g).indexOf(value);
  79. // },
  80. // item: function (i) {
  81. // return self.className.split(/\s+/g)[i] || null;
  82. // },
  83. // };
  84. // },
  85. // });
  86. // }
  87. /***************************************************************************************************
  88. * BROWSER POLYFILLS
  89. */
  90. // import 'core-js/es/symbol';
  91. // import 'core-js/es/object';
  92. // import 'core-js/es/function';
  93. // import 'core-js/es/parse-int';
  94. // import 'core-js/es/parse-float';
  95. // import 'core-js/es/number';
  96. // import 'core-js/es/math';
  97. // import 'core-js/es/string';
  98. // import 'core-js/es/date';
  99. // import 'core-js/es/array';
  100. // import 'core-js/es/regexp';
  101. // import 'core-js/es/map';
  102. // import 'core-js/es/weak-map';
  103. // import 'core-js/es/set';
  104. // import 'babel-polyfill';
  105. // /** IE10 and IE11 requires the following for NgClass support on SVG elements */
  106. // import 'classlist.js'; // Run `npm install --save classlist.js`.
  107. // import 'web-animations-js'; // Run `npm install --save web-animations-js`.
  108. // import 'core-js/es/reflect';
  109. /**
  110. * Web Animations `@angular/platform-browser/animations`
  111. * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari.
  112. * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0).
  113. */
  114. /**
  115. * By default, zone.js will patch all possible macroTask and DomEvents
  116. * user can disable parts of macroTask/DomEvents patch by setting following flags
  117. * because those flags need to be set before `zone.js` being loaded, and webpack
  118. * will put import in the top of bundle, so user need to create a separate file
  119. * in this directory (for example: zone-flags.ts), and put the following flags
  120. * into that file, and then add the following code before importing zone.js.
  121. * import './zone-flags.ts';
  122. *
  123. * The flags allowed in zone-flags.ts are listed here.
  124. *
  125. * The following flags will work for all browsers.
  126. *
  127. * (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame
  128. * (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick
  129. * (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames
  130. *
  131. * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js
  132. * with the following flag, it will bypass `zone.js` patch for IE/Edge
  133. *
  134. * (window as any).__Zone_enable_cross_context_check = true;
  135. *
  136. */
  137. /***************************************************************************************************
  138. * Zone JS is required by default for Angular itself.
  139. */
  140. // import 'zone.js';
  141. // import 'zone.js/dist/long-stack-trace-zone.js';
  142. /***************************************************************************************************
  143. * APPLICATION IMPORTS
  144. */
  145. import 'zone.js/dist/zone'; // Included with Angular CLI.
  146. // import 'babel-polyfill';
  147. // zone.js需在babel-polyfill之前引入