https://github.com/caiogondim/async-preload-img
Promise based image preloader
https://github.com/caiogondim/async-preload-img
Last synced: 3 months ago
JSON representation
Promise based image preloader
- Host: GitHub
- URL: https://github.com/caiogondim/async-preload-img
- Owner: caiogondim
- Created: 2018-11-14T01:13:13.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-11-14T16:39:33.000Z (over 6 years ago)
- Last Synced: 2025-02-25T14:06:50.908Z (3 months ago)
- Language: JavaScript
- Homepage: https://npm.im/async-preload-img
- Size: 6.84 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# async-preload-img
> Promise based image preloader
## Installation
```bash
npm install --save async-preload-img
```## Usage
`async/await`
```js
import preloadImg from 'async-preload-img'try {
await preloadImg('https://image-path.com')
// Image loaded
} catch (error) {
// Failed to load image
}
````Promise`
```js
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](https://caiogondim.com) ·
GitHub [@caiogondim](https://github.com/caiogondim) ·
Twitter [@caio_gondim](https://twitter.com/caio_gondim)