Skip to content
This repository has been archived by the owner on Sep 24, 2018. It is now read-only.

Latest commit

 

History

History
50 lines (38 loc) · 1.13 KB

README.md

File metadata and controls

50 lines (38 loc) · 1.13 KB

web-assets-manager

code style: prettier Dependency Status DevDependency Status Travis Build Status NPM Downloads

Manager for web assets.

Install

$ npm install web-assets-manager

Usage

// wam is a singletone
import wam from 'web-assets-manager';

const assets = {
  logo: 'https://cdn.example.com/logo.png',
  bg: 'https://cdn.example.com/bg.jpg',
  // ...
};

// setup assets
wam.setup(assets);

// preload assets
wam.preload(
  function onProgress(currentProgress) {
    console.log(currentProgress);
  },
  function onComplete() {
    console.log('complete');
  }
);

// get assets
wam.get('logo'); // 'https://cdn.example.com/logo.png'
wam.get('bg'); // 'https://cdn.example.com/bg.jpg'

Todo

  • documents about API
  • strict type checking