@ndla/polyfill
TypeScript icon, indicating that this package has built-in type declarations

1.0.9 • Public • Published

Polyfill

This package includes polyfills for various browsers, but is mainly intended for IE 11. It includes minimum requirements and commonly used language features used by NDLA projects.

Installation

$ yarn @ndla/polyfill

Usage

Simple

// This must be the first line in your bundle.
import '@ndla/polyfill';

Advanced

  1. Create an umd build of @ndla/polyfill
  2. Use <ScriptLoader> to conditional load the polyfill based on the following features. Scripts that depend on the polyfill are loaded after the polyfill.
import ScriptLoader from '@ndla/polyfill/lib/ScriptLoader';

const Document = (props) => {
  const polyfill = { src: '/polyfill.min.js' };
  const scripts = [{ src: '/vendor.min.js' }, { src: '/client.min.js' }];
  return (
    <html>
      <head />
      <body>
        <ScriptLoader polyfill={polyfill} scripts={scripts} />
      </body>
    </html>
  );
};

/@ndla/polyfill/

    Package Sidebar

    Install

    npm i @ndla/polyfill

    Weekly Downloads

    1

    Version

    1.0.9

    License

    GPL-3.0

    Unpacked Size

    48.3 kB

    Total Files

    15

    Last publish

    Collaborators

    • kronen_ki
    • rauboti
    • mapoken
    • katrinewi
    • ndlauser
    • jonasc-knowit
    • gunnarvelle
    • jnatten