1.2.0 • Published 5 years ago

loaderz v1.2.0

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

loaderz

Build Status license license license

A very easy-to-use asset-loader using promises. Supports images, audio and video.

Installation

Install using yarn or npm:

  • yarn add loaderz
  • npm install loaderz --save

You can also try the latest features that are not currently live with the @next tag: yarn add loaders@next

Usage

import { Loader } from 'loaderz';

const assetLoader = new Loader();
const images = [
  'https://picsum.photos/450',
  'https://picsum.photos/550',
  'https://picsum.photos/650',
];

assetLoader.queue('image', images);
assetLoader.queue('audio', 'http://www.noiseaddicts.com/samples_1w72b820/3721.mp3');
assetLoader.queue('video', 'http://www.sample-videos.com/video/mp4/720/big_buck_bunny_720p_5mb.mp4');

assetLoader.start().then((response) => console.log('All urls have been loaded, do whatever you want here:', response));
  • Loader#queue:type, url(string | string[]): accepts 3 different types (audio, image, video).
  • Loader#start: used to load all the queued resources. Returns a promise so you can chain with then and catch.

Contribute

All the code is written in Typescript. Feel free to contribute by creating issues and PRs:

  1. Fork and clone the repo: git@github.com:username/loaderz.git
  2. Install all dev-deps: yarn install or npm install
  3. Run the demo: yarn demo (localhost:8080)
  4. Edit some files
  5. Run tests: yarn test
  6. Build lib: yarn build
  7. Commit and push your edits, then create a PR

License

Under MIT license, view the license file for more information.

1.2.0

5 years ago

1.1.0

6 years ago

1.1.0-n

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago