imgz
v0.0.2
Published
Tiny image sources loader
Downloads
6
Readme
Imgz
Tiny image sources loader. :framed_picture:
Install
yarn add imgz
npm install imgz --save
The UMD and style builds are also available on unpkg.
<link rel="stylesheet" href="https://unpkg.com/imgz/dist/imgz.min.css">
You can use the component via window.imgz
Usage
import { Loader } from 'imgz'
const images = [
'https://i.imgur.com/G5MR088.png',
'http://server/not-found-image.png',
'https://i.imgur.com/G5MR088.png'
]
Loader (images, (image, index, event) => console.log('Image loaded:', image))
API
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.
Contributions
Pull requests or issues are very appreciated.
License
MIT license
© 2018 José Luis Quintana