mirror of https://github.com/Siphonay/mastodon
[Glitch] Rework polyfills loading
Port a3a2414f0e
to glitch-soc
Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
parent
e22a88b512
commit
526fe33e2f
|
@ -1,5 +1,5 @@
|
|||
import 'packs/public-path';
|
||||
import loadPolyfills from 'flavours/glitch/load_polyfills';
|
||||
import { loadPolyfills } from 'flavours/glitch/polyfills';
|
||||
|
||||
loadPolyfills().then(async () => {
|
||||
const { default: main } = await import('flavours/glitch/main');
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import 'packs/public-path';
|
||||
import loadPolyfills from 'flavours/glitch/load_polyfills';
|
||||
import { loadPolyfills } from 'flavours/glitch/polyfills';
|
||||
import ready from 'flavours/glitch/ready';
|
||||
import loadKeyboardExtensions from 'flavours/glitch/load_keyboard_extensions';
|
||||
import axios from 'axios';
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import 'packs/public-path';
|
||||
import loadPolyfills from 'flavours/glitch/load_polyfills';
|
||||
import { loadPolyfills } from 'flavours/glitch/polyfills';
|
||||
import loadKeyboardExtensions from 'flavours/glitch/load_keyboard_extensions';
|
||||
import { delegate } from '@rails/ujs';
|
||||
import 'cocoon-js-vanilla';
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import 'packs/public-path';
|
||||
import loadPolyfills from 'flavours/glitch/load_polyfills';
|
||||
import { loadPolyfills } from 'flavours/glitch/polyfills';
|
||||
import ComposeContainer from 'flavours/glitch/containers/compose_container';
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
|
|
|
@ -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;
|
Loading…
Reference in New Issue