vanilla-preloader

Simple vanilla JavaScript vanilla preloader.

Usage no npm install needed!

<script type="module">
  import vanillaPreloader from 'https://cdn.skypack.dev/vanilla-preloader';
</script>

README

Vanilla Preloader

Simple Vanilla JavaScript to help you preload your images.

Installation

NPM

npm install vanilla-preloader --save

Bower

bower install vanilla-preloader --save

Old School

Download the zip file.

Usage

Browserify + ES2015

import VanillaPreloader from 'vanilla-preloader'

new VanillaPreloader([
    'https://example.com/path/to/image.jpg',
    'https://example.com/path/to/image.jpg',
    'https://example.com/path/to/image.jpg',
    'https://example.com/path/to/image.jpg',
    'https://example.com/path/to/image.jpg',
    'https://example.com/path/to/image.jpg',
], function (images) {
    console.log('Every image is now loaded!')
})

Browserify + ES5

var VanillaPreloader = require('vanilla-preloader');

new VanillaPreloader([
    'https://example.com/path/to/image.jpg',
    'https://example.com/path/to/image.jpg',
    'https://example.com/path/to/image.jpg',
    'https://example.com/path/to/image.jpg',
    'https://example.com/path/to/image.jpg',
    'https://example.com/path/to/image.jpg',
], function (images) {
    console.log('Every image is now loaded!');
});

Old School

new VanillaPreloader([
    'https://example.com/path/to/image.jpg',
    'https://example.com/path/to/image.jpg',
    'https://example.com/path/to/image.jpg',
    'https://example.com/path/to/image.jpg',
    'https://example.com/path/to/image.jpg',
    'https://example.com/path/to/image.jpg',
], function (images) {
    console.log('Every image is now loaded!');
});

License

WTFPL