1.0.2 • Published 6 years ago

async-preload-img v1.0.2

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

async-preload-img

Promise based image preloader

Installation

npm install --save async-preload-img

Usage

async/await

import preloadImg from 'async-preload-img'

try {
  await preloadImg('https://image-path.com')
  // Image loaded
} catch (error) {
  // Failed to load image
}

Promise

import preloadImg from 'async-preload-img'

preloadImg('https://image-path.com')
  .then(() => {
    // Image loaded
  })
  .catch(() => {
    // Failed to load image
  })

Sponsor

If you found this library useful and are willing to donate, transfer some bitcoins to 1BqqKiZA8Tq43CdukdBEwCdDD42jxuX9UY.


caiogondim.com  ·  GitHub @caiogondim  ·  Twitter @caio_gondim

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago