# preload-all

> Preload or Prefetch all resource for your web app,including im\js\css...

Latest version **1.0.6** (published 2020-07-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install preload-all
pnpm add preload-all
yarn add preload-all
bun add preload-all
```

## 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.6 |
| Published | 2020-07-29 |
| First published | 2020-07-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Author | xkh |
| Maintainers | xkh |
| Keywords | preload, prefetch, preload img, preload-img, preload js, preload-js, preload css, preload-css, preload all, preload-all |

## Links

- npm: https://www.npmjs.com/package/preload-all
- Repository: https://github.com/xkh/preload-all
- Homepage: https://github.com/xkh/preload-all#readme
- Issues: https://github.com/xkh/preload-all/issues
- npm.io page: https://npm.io/package/preload-all

## Recent versions

- 1.0.6 (latest) — 2020-07-29
- 1.0.5 — 2020-07-29
- 1.0.4 — 2020-07-28
- 1.0.3 — 2020-07-28
- 1.0.2 — 2020-07-28
- 1.0.1 — 2020-07-28
- 1.0.0 — 2020-07-26

## README

<!--
 * @Autor: xkh
 * @Date: 2020-07-27 18:55:19
 * @LastEditors: xkh
 * @LastEditTime: 2020-07-27 19:11:27
-->

English | [简体中文](./README_zh.md)

# preload-all

> Preload all resources，image、js、css... Super small size `1.7K`

> Support multi-format resource loading and automatic suffix recognition. It is recommended to carry the value of type type to reduce the loading time.
> return `Promise`, Usage examples adopt `.then .catch`, Of course you can use it`async await`.

## Install

```bash
npm i preload-all --save
```

## Options

| param  | desc                                         | values          | type     | must |
| ------ | -------------------------------------------- | --------------- | -------- | ---- |
| links  | resource list                                | []              | string[] | yes  |
| type   | resource type                                | image/js/css/'' | string   | no   |
| ignore | Ignore loading exception resources           | true/false      | boolean  | no   |
| retry  | Number of failed retries of resource loading | 0               | number   | no   |

## Usage

#### First

```bash
import {preloadAll} from 'preload-all';
```

#### Preload all resource

```bash
preloadAll({
    links: [
        "https://xxx01.jpg",        //Image
        "https://xxx02.js",         //Js
        "https://xxx03.css",        //Css
    ]
}).then((res)=>{
    //todo success
}).catch((error)=>{
    //todo fail
})
```

#### Preload Image

```bash
preloadAll({
    links: [
        "https://xxx01.jpg",
        "https://xxx02.png",
        "https://xxx03.gif",
    ],
    type: 'image'
})
```

#### Preload Js

```bash
preloadAll({
    links: [
        "https://xxx01.js",
        "https://xxx02.js",
        "https://xxx03.js",
    ],
    type: 'js'
})
```

#### Preload Css

```bash
preloadAll({
    links: [
        "https://xxx01.css",
        "https://xxx02.css",
        "https://xxx03.css",
    ],
    type: 'css'
})
```

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