English | 简体中文
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 itasync await
.
Install
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
import {preloadAll} from 'preload-all';
Preload all resource
preloadAll.then((res)=>{ //todo success}).catch((error)=>{ //todo fail})
Preload Image
preloadAll
Preload Js
preloadAll
Preload Css
preloadAll