dynamic-load-script
TypeScript icon, indicating that this package has built-in type declarations

1.0.6 • Public • Published

dynamic-load-script

NPM Package NPM downloads gzip size GitHub

English | 简体中文

Dynamic loading (CDN / local script)

The aim of the project is to create an easy to use, lightweight, cross-browser, general purpose loading script library.

Check the code in the example if there is a problem in use.

Try it in CodePen

Installation

In a browser

You can use it at ./dist/*

<script src="load-script.min.js"></script>

Using npm

npm install dynamic-load-script --save

Using yarn

yarn add dynamic-load-script --save

Usage

import loadScript from 'dynamic-load-script';

loadScript('yourCDN')
  .then((res) => {
    // success...
  })
  .catch((err) => {
    // fail...
  });

Cloning this repository

Cloning the repo with all its history results in a ~2 MB download. If you don't need the whole history you can use the depth parameter to significantly reduce download size.

git clone --depth=1 https://github.com/kangyana/dynamic-load-script.git

Change log

Releases

License

MIT

Copyright (c) 2022-present, kangyana

Readme

Keywords

Package Sidebar

Install

npm i dynamic-load-script

Weekly Downloads

1

Version

1.0.6

License

MIT

Unpacked Size

10.8 kB

Total Files

18

Last publish

Collaborators

  • kangyan