Rework polyfills loading (#24907)
This commit is contained in:
parent
536dd046d4
commit
a3a2414f0e
9 changed files with 25 additions and 99 deletions
|
@ -1,26 +1,16 @@
|
|||
import 'intl';
|
||||
import 'intl/locale-data/jsonp/en';
|
||||
import 'es6-symbol/implement';
|
||||
import assign from 'object-assign';
|
||||
import values from 'object.values';
|
||||
import { decode as decodeBase64 } from './utils/base64';
|
||||
import promiseFinally from 'promise.prototype.finally';
|
||||
|
||||
if (!Object.assign) {
|
||||
Object.assign = assign;
|
||||
}
|
||||
|
||||
if (!Object.values) {
|
||||
values.shim();
|
||||
}
|
||||
|
||||
promiseFinally.shim();
|
||||
import 'core-js/features/object/assign';
|
||||
import 'core-js/features/object/values';
|
||||
import 'core-js/features/symbol';
|
||||
import 'core-js/features/promise/finally';
|
||||
import { decode as decodeBase64 } from '../utils/base64';
|
||||
|
||||
if (!HTMLCanvasElement.prototype.toBlob) {
|
||||
const BASE64_MARKER = ';base64,';
|
||||
|
||||
Object.defineProperty(HTMLCanvasElement.prototype, 'toBlob', {
|
||||
value(callback, type = 'image/png', quality) {
|
||||
value(callback: BlobCallback, type = 'image/png', quality: any) {
|
||||
const dataURL = this.toDataURL(type, quality);
|
||||
let data;
|
||||
|
|
@ -10,14 +10,14 @@ function importExtraPolyfills() {
|
|||
return import(/* webpackChunkName: "extra_polyfills" */ './extra_polyfills');
|
||||
}
|
||||
|
||||
function loadPolyfills() {
|
||||
export function loadPolyfills() {
|
||||
const needsBasePolyfills = !(
|
||||
HTMLCanvasElement.prototype.toBlob &&
|
||||
window.Intl &&
|
||||
Object.assign &&
|
||||
Object.values &&
|
||||
window.Symbol &&
|
||||
Promise.prototype.finally
|
||||
'toBlob' in HTMLCanvasElement.prototype &&
|
||||
'Intl' in window &&
|
||||
'assign' in Object &&
|
||||
'values' in Object &&
|
||||
'Symbol' in window &&
|
||||
'finally' in Promise.prototype
|
||||
);
|
||||
|
||||
// Latest version of Firefox and Safari do not have IntersectionObserver.
|
||||
|
@ -36,5 +36,3 @@ function loadPolyfills() {
|
|||
needsExtraPolyfills && importExtraPolyfills(),
|
||||
]);
|
||||
}
|
||||
|
||||
export default loadPolyfills;
|
|
@ -1,5 +1,5 @@
|
|||
import './public-path';
|
||||
import loadPolyfills from '../mastodon/load_polyfills';
|
||||
import { loadPolyfills } from '../mastodon/polyfills';
|
||||
import { start } from '../mastodon/common';
|
||||
|
||||
start();
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import './public-path';
|
||||
import loadPolyfills from '../mastodon/load_polyfills';
|
||||
import escapeTextContentForBrowser from 'escape-html';
|
||||
import { loadPolyfills } from '../mastodon/polyfills';
|
||||
import ready from '../mastodon/ready';
|
||||
import { start } from '../mastodon/common';
|
||||
|
||||
import escapeTextContentForBrowser from 'escape-html';
|
||||
import ready from '../mastodon/ready';
|
||||
import loadKeyboardExtensions from '../mastodon/load_keyboard_extensions';
|
||||
import 'cocoon-js-vanilla';
|
||||
import axios from 'axios';
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import './public-path';
|
||||
import loadPolyfills from '../mastodon/load_polyfills';
|
||||
import { loadPolyfills } from '../mastodon/polyfills';
|
||||
import { start } from '../mastodon/common';
|
||||
import ready from '../mastodon/ready';
|
||||
import ComposeContainer from '../mastodon/containers/compose_container';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue