Skip to content
This repository has been archived by the owner on Feb 9, 2022. It is now read-only.

tyczynski/preloadpics

Repository files navigation

preloadpics npm version

Lightweight library for preloading images with callback.

Usage

preloadpics(
  // array with urls
  sources,
);

Example

import preloadpics from 'preloadpics';

preloadpics([
  'https://images.unsplash.com/photo-1569099377939-569bbac3c4df?ixlib=rb-1.2.1',
  'https://images.unsplash.com/photo-1569133237946-091ca2397418?ixlib=rb-1.2.1',
  'https://images.unsplash.com/photo-1569099377939-569bbac3c4df?ixlib=rb-1.2.1',
]).then(results => console.log('finished')); // results => array with `load` and `error` events of the `Image` object.

License

MIT © Przemysław Tyczyński