tachyon-polyfill
TypeScript icon, indicating that this package has built-in type declarations

32.0.0 • Public • Published

Tachyon-Polyfill

A package to polyfill Browser features via Twitch's hosted version of Polyfill.io. Currently we only support v2 of Polyfill.io.

Installation

yarn add tachyon-polyfill

React Apps

import type { FC } from 'react';
import { PolyfillPreload, PolyfillScript } from 'tachyon-polyfill';

const App: FC = ({ userLocale }) => {
  return (
    <html>
      <head>
        {/* Optional: ensures this script download is priortized for perf reasons */}
        <PolyfillPreload locale={userLocale} />
      </head>
      <body>
        {/* Place above all app scripts to ensure availability of features */}
        <PolyfillScript locale={userLocale} />
        <script src="app.js" />
      </body>
    </html>
  );
};

For Other Apps

For non-React applications we also expose the more primitive getPolyfillUrl which will return you a string that can be templated into an HTML script elements.

import { getPolyfillUrl } from 'tachyon-polyfill';

const polyfillUrl = getPolyfillUrl({ userLocale });

/tachyon-polyfill/

    Package Sidebar

    Install

    npm i tachyon-polyfill

    Weekly Downloads

    0

    Version

    32.0.0

    License

    UNLICENSED

    Unpacked Size

    14.7 kB

    Total Files

    26

    Last publish

    Collaborators

    • frgjdhskxjogu