0.3.0 • Published 7 years ago

preloadimg v0.3.0

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

preloadimg

npm package NPM downloads

A library for preload images


Install

npm install --save preloadimg

Usage

Use in script tag

<script src="src/preloadimg.js" charset="utf-8"></script>
<script>
  var imgs = [
    'img/image1.png',
    'img/image2.png',
    'img/image3.png',
  ];

  preloadimg(imgs, success => {  // everyone image preloaded success
    console.log(success);

  }, fail => {    // everyone image preloaded fail
    console.log(fail)

  }, () => {    // it will called when all images preloaded whatever succeeded or failed
    console.log('all images preload completely!')
  });
</script>

Use in ES6 modules or CommonJS

// in ES6 modules
import preloadimg from 'preloadimg';

// in CommonJS
// var preloadimg = require('preloadimg');

preloadimg([
  'img/image1.png',
  'img/image2.png',
  'img/image3.png',
], success => {   // everyone image preloaded success
  console.log(success);
}, fail => {    // everyone image preloaded fail
  console.log(fail)
}, () => {    // it will called when all images preloaded whatever succeeded or failed
  console.log('all images preload completely!')
});
0.3.0

7 years ago

0.2.0

7 years ago

0.1.3

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago

0.0.1

7 years ago