The code powering m.abunchtell.com https://m.abunchtell.com
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.
 
 
 
 

40 рядки
1.2 KiB

  1. // Convenience function to load polyfills and return a promise when it's done.
  2. // If there are no polyfills, then this is just Promise.resolve() which means
  3. // it will execute in the same tick of the event loop (i.e. near-instant).
  4. function importBasePolyfills() {
  5. return import(/* webpackChunkName: "base_polyfills" */ './base_polyfills');
  6. }
  7. function importExtraPolyfills() {
  8. return import(/* webpackChunkName: "extra_polyfills" */ './extra_polyfills');
  9. }
  10. function loadPolyfills() {
  11. const needsBasePolyfills = !(
  12. window.Intl &&
  13. Object.assign &&
  14. Number.isNaN &&
  15. window.Symbol &&
  16. Array.prototype.includes
  17. );
  18. // Latest version of Firefox and Safari do not have IntersectionObserver.
  19. // Edge does not have requestIdleCallback and object-fit CSS property.
  20. // This avoids shipping them all the polyfills.
  21. const needsExtraPolyfills = !(
  22. window.IntersectionObserver &&
  23. window.IntersectionObserverEntry &&
  24. 'isIntersecting' in IntersectionObserverEntry.prototype &&
  25. window.requestIdleCallback &&
  26. 'object-fit' in (new Image()).style
  27. );
  28. return Promise.all([
  29. needsBasePolyfills && importBasePolyfills(),
  30. needsExtraPolyfills && importExtraPolyfills(),
  31. ]);
  32. }
  33. export default loadPolyfills;