const coolPromise = new Promise(resolve => { createCoolStuff(); resolve(); }); coolPromise.then(() => { console.log(); });
if (typeof window.Promise !== 'function') { loadPromisePolyfill(); }
<script src="https://cdn.polyfill.io/polyfill.js?features=Promise,fetch,Intl"></script>
<script src="/app.js"></script><script src="https://cdn.polyfill.io/polyfill.js?features=Promise,fetch,Intl"></script> <script src="/app.js"></script>
<script src="https://cdn.polyfill.io/polyfill.js?features=Promise,fetch,Intl"></script> <script src="/app.js"></script>
⚒ a curated list of polyfills with their features detection tests
🍞 a node server able to return a custom bundles of polyfills in one request
👀 the inlined code that detect the polyfills the browser needs and load them before the app's code executes
import filler from 'mastic-filler'; import { Promise } from 'mastic-polyfills'; filler({ polyfills: [Promise], url: 'http://url.of.your.mastic.server', scripts: [ 'assets/commons.js', 'assets/weekend.js' ] });