0
0
Fork 0

Add dynamic polyfills for older browsers (#2985)

Fixes #2941
This commit is contained in:
Nolan Lawson 2017-05-11 02:26:06 -07:00 committed by Eugen Rochko
parent 2d000e9c4e
commit 0ec77c5b3e
5 changed files with 74 additions and 30 deletions

View file

@ -1,25 +1,9 @@
import Mastodon from 'mastodon/containers/mastodon';
import React from 'react';
import ReactDOM from 'react-dom';
import Rails from 'rails-ujs';
import 'font-awesome/css/font-awesome.css';
import '../styles/application.scss';
import main from '../mastodon/main';
if (!window.Intl) {
require('intl');
require('intl/locale-data/jsonp/en.js');
if (!window.Intl || !Object.assign || !Number.isNaN ||
!window.Symbol || !Array.prototype.includes) {
// load polyfills dynamically
import('../mastodon/polyfills').then(main);
} else {
main();
}
window.Perf = require('react-addons-perf');
Rails.start();
require.context('../images/', true);
require.context('../../assets/stylesheets/', false, /custom.*\.scss$/);
document.addEventListener('DOMContentLoaded', () => {
const mountNode = document.getElementById('mastodon');
const props = JSON.parse(mountNode.getAttribute('data-props'));
ReactDOM.render(<Mastodon {...props} />, mountNode);
});