preload-it
A tiny 1kb JavaScript library for preloading assets on the browser via XHR2. It provides the ability to preload assets of different file types and composite progress events.
Installing
If you use npm, npm i preload-it
. Otherwise, download the latest release. The released bundle supports anonymous AMD, CommonJS, and vanilla environments. You can load directly from unpkg. For example:
For the minified version:
preload-it is written using ES2015 modules. To import preload-it into an ES2015 application, import into a namespace:
or
;const preload = ;
Getting started
const preload = ; preload; preload { console;} preload { console;} preload { console;} preload { console;}
Canceling preload of assets
Preloading of assets can be canceled at any time during fetching, when calling preload.cancel()
all assets already preloaded will be available to use, however the download of pending assets will be abandoned, and status
will be set to 0
for those remaining items.
preload preload { console;}
License
Released for free under the MIT license, which means you can use it for almost any purpose (including commercial projects). We appreciate credit where possible, but it is not a requirement.
MIT.