0.2.0 • Published 5 months ago

loadx v0.2.0

Weekly downloads
7
License
Apache-2.0
Repository
github
Last release
5 months ago

loadx npm CI

Simple asset loader that allows loading of image, CSS, and JavaScript files, using the Promise API, and fires a callback upon success or failure.

  • 🚚 Load JS, CSS or Image
  • 🚀 Cache results
  • ⏳️ Works beautifully with promise and async/await
  • 📦️ Just 400 bytes of gzipped ES3

Install

$ npm install --save loadx

Usage

import loadx from 'loadx';

async function loadResources() {
	// loading a JavaScript resource
	await loadx.js('https://cdnjs.cloudflare.com/ajax/libs/axios/0.19.2/axios.min.js');

	// from here, you can start using axios regularly
	const user = await axios.get('/user?ID=12345');

	// you can load CSS...
	await loadx.css('https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css');

	// ...and image as well
	const imageElement = await loadx.img('https://picsum.photos/200/300');
}

License

Apache-2.0 © Cesar William

0.2.0

5 months ago

0.1.1

4 years ago

0.1.0

4 years ago

0.0.1

4 years ago