Socket
Socket
Sign inDemoInstall

@lite-v3/polyfills

Package Overview
Dependencies
84
Maintainers
5
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lite-v3/polyfills

A standard polyfill library for tokopedia web services


Version published
Maintainers
5
Weekly downloads
1,090
decreased by-7.78%

Weekly downloads

Readme

Source

@lite-v3/polyfills

A standard polyfill library for tokopedia web services

By Tokopedia Version

This module is only needed for webpack 4+.

Prerequisites

Webpack 4+

Install

# Using npm
npm install @lite-v3/polyfills

# Using yarn
yarn add @lite-v3/polyfills

# Using pnpm
pnpm install @lite-v3/polyfills

Usage

Add the following to your entry client file:

import requirePolyfills, { definePolyfills } from '@lite-v3/polyfills';

requirePolyfills(condition, function () {
  runYourService();
});

or if you have additional polyfills

import requirePolyfills from '@lite-v3/polyfills';

const customPolyfills = [
  {
    test: !(window.fetch || window.self.fetch),
    load: () => {
      return new Promise(resolve => {
        resolve(import(/* webpackChunkName: "unfetch-polyfill" */ 'unfetch/polyfill/index'));
      });
    },
  },
];

requirePolyfills(condition, definePolyfills(customPolyfills), function () {
  runYourService();
});

API

requirePolyfills(condition, callback)

parameter

condition: Boolean callback: () => void

definePolyfills(polyfills)

parameter

polyfills: { test: boolean, load: () => Promise<unknown> }[]}


Code By WPE Team @Tokopedia

FAQs

Last updated on 27 Oct 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc