Skip to content

🌄✨ tiny promise-based <img> loader for the browser

License

Notifications You must be signed in to change notification settings

semibran/img-load

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 

Repository files navigation

img-load

tiny promise-based <img> loader for the browser

loadImage("images/foo.png")
  .then(image => document.body.appendChild(image))

usage

npm badge

loadImage(path)

Returns a Promise which resolves to the image indicated by path.

Consider using loadImage within an async function to further simplify usage.

import loadImage from "img-load"

async function main() {
  let foo = await loadImage("images/foo.png")
  let bar = await loadImage("images/bar.png")
  // use `foo.png` and `bar.png`
}

main()

About

🌄✨ tiny promise-based <img> loader for the browser

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published