Skip to content

动态加载JavaScript资源 | Dynamic Loading JavaScript Source

License

Notifications You must be signed in to change notification settings

Lete114/Loading-Script

Repository files navigation

Dynamic Loading JavaScript

master MIT License

Installing

Using npm:

$ npm install loading-script

Using jsDelivr CDN:

<script src="https://cdn.jsdelivr.net/npm/loading-script/dist/loading-script.js"></script>

Using unpkg CDN:

<script src="https://unpkg.com/loading-script/dist/loading-script.js"></script>

Example Usage

Node.js

const {getScript} = require("loading-script");
getScript('test.js', function(){
  console.log('onload')
});

Browser

<script src="https://cdn.jsdelivr.net/npm/loading-script/dist/loading-script.js"></script>
getScript('test.js', function(){
  console.log('onload')
});

License

MIT