All Projects → TotomInc → Loaderz

TotomInc / Loaderz

Licence: mit
⚡️ A very easy-to-use, blazing fast asset-loader using promises. Support older-browsers and preload images, audios and videos.

Programming Languages

typescript
32286 projects
es6
455 projects

Labels

Projects that are alternatives of or similar to Loaderz

Vue2 Element
基于vue2 + vue-router2 + element-ui + vuex2 + fetch + webpack2 企业级后台管理系统最佳实践
Stars: ✭ 112 (-13.85%)
Mutual labels:  promise
Bach
Compose your async functions with elegance.
Stars: ✭ 117 (-10%)
Mutual labels:  promise
Notes
前端学习笔记,面试复习手册
Stars: ✭ 127 (-2.31%)
Mutual labels:  promise
Promise Queue Plus
Promise-based queue. Support timeout, retry and so on.
Stars: ✭ 113 (-13.08%)
Mutual labels:  promise
Article
前端相关、CSS、JavaScript、工具、解决方案…相关文章
Stars: ✭ 116 (-10.77%)
Mutual labels:  promise
Lips
Scheme based powerful lisp interpreter written in JavaScript
Stars: ✭ 120 (-7.69%)
Mutual labels:  promise
Simple Fs
Handles files on indexeddb like you would do in node.js (promise)
Stars: ✭ 111 (-14.62%)
Mutual labels:  promise
Kitchen Async
A Promise library for ClojureScript, or a poor man's core.async
Stars: ✭ 128 (-1.54%)
Mutual labels:  promise
Zousan
A Lightning Fast, Yet Very Small Promise A+ Compliant Implementation
Stars: ✭ 117 (-10%)
Mutual labels:  promise
Easysoap
A simple to use SoapClient for Node.js
Stars: ✭ 122 (-6.15%)
Mutual labels:  promise
Jdeferred
Java Deferred/Promise library similar to JQuery.
Stars: ✭ 1,483 (+1040.77%)
Mutual labels:  promise
Postmate
📭 A powerful, simple, promise-based postMessage library.
Stars: ✭ 1,638 (+1160%)
Mutual labels:  promise
Promise Throttle
A small library to throttle promises. Useful to avoid rate limiting when using REST APIs.
Stars: ✭ 121 (-6.92%)
Mutual labels:  promise
Blizzard.js
A promise-based Node.JS library for the Blizzard Battle.net Community Platform API
Stars: ✭ 113 (-13.08%)
Mutual labels:  promise
Form Validation.js
The most customizable validation framework for JavaScript.
Stars: ✭ 127 (-2.31%)
Mutual labels:  promise
P Queue
Promise queue with concurrency control
Stars: ✭ 1,863 (+1333.08%)
Mutual labels:  promise
Stop.js
🐦 The Promise base `setTimeout`, release your callback
Stars: ✭ 120 (-7.69%)
Mutual labels:  promise
Image Promise
🎑🤞 Load one or more images, return a promise. Tiny, browser-only, no dependencies.
Stars: ✭ 129 (-0.77%)
Mutual labels:  promise
Tas
Make it easy to develop large, complex Node.js app.
Stars: ✭ 128 (-1.54%)
Mutual labels:  promise
Ts Polyfill
Runtime polyfills for TypeScript libs, powered by core-js! 🔋 🔩
Stars: ✭ 122 (-6.15%)
Mutual labels:  promise

Build Status license license license

A very easy-to-use asset-loader using promises. Supports images, audio and video. Fully documented for a perfect usage in your TypeScript projects.

Installation

Install using yarn or npm:

  • yarn add loaderz
  • npm install loaderz --save

Usage

// Default export of Loaderz is the Loader.
import Loader from 'loaderz';

// A list of heavy images to load, it could be art-assets for your HTML5 game
const images = [
  'https://images.unsplash.com/photo-1549360336-6a77ea5193eb',
  'https://images.unsplash.com/photo-1549379458-e8f7034360a9',
  'https://images.unsplash.com/photo-1548175850-b5a765959436',
];

// Some audio elements to spice-up your HTML5 game
const audios = [
  'http://www.sample-videos.com/audio/mp3/crowd-cheering.mp3',
  'http://www.sample-videos.com/audio/mp3/wave.mp3',
];

// Instanciate the loader, you can easily implement it anywhere in your project
const loader = new Loader();

// Queue all our different resources (we can chain since queue returns the
// instance of loader)
loader
  .queue('image', images)
  .queue('audio', audios);

// Start loading the resources and have a full control of the global loading
// state using a promise and return a response with all elements loaded
loader.start()
  .then(response => console.log('All urls have been loaded, do whatever you want here:', response));

Docs

  • Loader#queue(type: string, src: string | string[]): accepts 3 different types of medias (audio, image, video).

  • Loader#start(): used to load all the queued resources. Returns a global promise of the resources loading.

  • Loader#queuedImages: an array of URLs of images queued to load.

  • Loader#queuedMedias: an array of MediaData elements queued to load.

Contribute

All the code is written in TypeScript. Feel free to contribute by creating issues, PRs or suggesting new features:

  1. Fork and clone the repo: [email protected]: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 or npm test
    • (optional) run yarn lint or npm run lint to automatically lint the files
  6. Commit and push your edits on a separate branch
  7. Create a PR which points on the develop branch

License

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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].