Tiny image sources loader. 🖼️
Imgz just loads string image URLs by index emitting a callback with image
, index
and event
parameters per load.
yarn add imgz
npm install imgz --save
The UMD build is also available on unpkg.
<link rel="stylesheet" href="https://unpkg.com/imgz/dist/imgz.min.js">
You can use the library via window.imgz
import { Loader } from 'imgz'
const images = [
'https://i.imgur.com/G5MR088.png', // ok!
'http://server/not-found-image.png', // error!
'https://i.imgur.com/G5MR088.png' // ok!
]
Loader(images, (image: HTMLImageElement | null, index: number, event: LoadEvent | ErrorEvent) => { })
function Loader (
// Sources
source: string | string[],
// Source loaded
(image: HTMLImageElement | null, index: number, event: LoadEvent | ErrorEvent) => void,
// Sources completed (optional)
(length: number) => void
)
See index.d.ts for more details.
Pull requests or issues are very appreciated.
MIT license
© 2018 José Luis Quintana