0.0.2 • Published 6 years ago

imgz v0.0.2

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

Imgz npm npm Build Status JavaScript Style Guide

Tiny image sources loader. :framed_picture:

Install

Yarn

yarn add imgz

NPM

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