# preloadify

> A dead simple image preloader for the web

Latest version **1.0.4** (published 2019-01-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install preloadify
pnpm add preloadify
yarn add preloadify
bun add preloadify
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.4 |
| Published | 2019-01-18 |
| First published | 2019-01-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 6.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Mark Amiraghyan |
| Maintainers | jncmark |
| Keywords | image, images, preload, preloader, web, js, javascript, es6, browser, script |

## Links

- npm: https://www.npmjs.com/package/preloadify
- Repository: https://github.com/JNCMark/preloadify
- Homepage: httpshttps://github.com/JNCMark/preloadify#readme
- Issues: https://github.com/JNCMark/preloadify/issues
- npm.io page: https://npm.io/package/preloadify

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 1.0.4 (latest) — 2019-01-18
- 1.0.3 — 2019-01-17
- 1.0.2 — 2019-01-17
- 1.0.1 — 2019-01-17

## README

# Preloadify 🌌
A __dead__ simple  image preloader for the web.  <br/>
Zero dependecies, super lightweight.  <br/>
Requires ES6 promises to work.

## Installation 💿
Preloadify can be installed in ES Modules syntax:
```js
import preloadify from "preloadify"
```
as a script tag:
```html
<script src="https://cdn.jsdelivr.net/npm/preloadify@latest/dist/index.min.js"></script>
<script>
    preloadify = preloadify.default; // Initalize
</script>
```
as a commonjs module:
```js
const {preloadify} = require("preloadify");
``` 
and as a AMD require:
```js
require(['preloadify'], function ({preloadify}) {
  preloadify(...);
});
```

## API 🐱‍👤

As said earlier, this package is __dead__ simple.
```js
async function dummyFunc() {
    await preloadify([src1, src2]);
    // OR
    await preloadify('src1');
    // Images are preloaded 🎉
    // <img src="src1"> will instantly load the image
}
function dummyFunc() {
    preloadify([src1, src2]).then(() => {
        // Images are preloaded 🎉
    })
}
```
As easy as that.  <br/>
There is a also an optional 'options' argument.  <br/>
It can have two properties:  <br/>
__oneach__:
```js
preloadify([src1, src2], {
    oneach(src) {
        // Called when a single image fully loads
        // and passes in that image's src
        console.log(`Image with source ${src} was loaded`);
    }
});
```
__onprogress__:
```js
preloadify([src1, src2], {
    onprogress(percents, [done, total]) {
        // Called the same time as oneach
        // Provides info on loading progress
        console.log(`Loading: ${percents}%`);
        // OR
        console.log(`Loading: ${done} of ${total}}`);
    }
});
```
Easy, right? 😀

---
_Source: https://npm.io/package/preloadify · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
