Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/coderaiser/load.js
Dynamically loading external JavaScript and CSS files
https://github.com/coderaiser/load.js
ajax css javascript load parallel series
Last synced: 3 days ago
JSON representation
Dynamically loading external JavaScript and CSS files
- Host: GitHub
- URL: https://github.com/coderaiser/load.js
- Owner: coderaiser
- License: mit
- Created: 2014-09-23T13:52:56.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2022-03-28T11:26:01.000Z (almost 3 years ago)
- Last Synced: 2024-12-03T15:42:41.359Z (about 1 month ago)
- Topics: ajax, css, javascript, load, parallel, series
- Language: JavaScript
- Size: 25.4 KB
- Stars: 19
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: ChangeLog
- License: LICENSE
Awesome Lists containing this project
README
# Load.js
Dynamically loading external JavaScript and CSS files
## Install
```
npm install load.js
```## How use?
```js
const load = require('load');/* you could use jquery functions here */
await load.js('jquery.js');/* load menu css and then do some magic */
await load.css('menu.css');/* recognition file type by extension */
const [e1, event] = await tryToCatch(load, 'css-or-.js');const [e2, footer] = await tryToCatch(load, 'template/footer.html');
const [e3, config] = await tryToCatch(load.json, 'config.json');
const [e4, header] = await tryToCatch(load.ajax, 'template/header.html');
/* load one-by-one */
await load.series([
'jquery.js',
'jq-console.js',
]);/* load all together */
await load.parallel([
'menu.css',
'menu.js',
]);
```## License
MIT