img-load

tiny promise-based <img> loader for the browser


Keywords
image-loader, async, promise, browser, fast, tiny
License
MIT
Install
npm install img-load@2.0.0

Documentation

img-load

Load an image for the browser from a given path

install

npm install img-load

usage

const load = require('img-load')

load('images/foo.png', (error, image) => {
  if (error) throw error
  document.body.appendChild(image)
})

image = load(path, callback)

Creates an HTMLImageElement instance using the given path, and executes callback upon completion.

license

MIT © Brandon Semilla