Skip to content

Instantly share code, notes, and snippets.

@juandc
Forked from davidgilbertson/index-sometimes-poly.js
Created September 20, 2018 14:15
Show Gist options
  • Save juandc/1e1353f673c9c0d83b2a0883f1793d1d to your computer and use it in GitHub Desktop.
Save juandc/1e1353f673c9c0d83b2a0883f1793d1d to your computer and use it in GitHub Desktop.
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App/App';
import './index.css';
const render = () => {
ReactDOM.render(<App />, document.getElementById('root'));
}
if (
'fetch' in window &&
'Intl' in window &&
'URL' in window &&
'Map' in window &&
'forEach' in NodeList.prototype &&
'startsWith' in String.prototype &&
'endsWith' in String.prototype &&
'includes' in String.prototype &&
'includes' in Array.prototype &&
'assign' in Object &&
'entries' in Object &&
'keys' in Object
) {
render();
} else {
import('./polyfills').then(render);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment