2022-01-08 13:31:02 -03:00

95 lines
3.3 KiB
Markdown

# Installing
<a href="https://bundlephobia.com/package/axios-cache-interceptor@latest"
><img
src="https://img.shields.io/bundlephobia/minzip/axios-cache-interceptor/latest?style=flat"
target="_blank"
alt="Minified Size"
/></a> <a href="https://packagephobia.com/result?p=axios-cache-interceptor@latest"
><img
src="https://packagephobia.com/badge?p=axios-cache-interceptor@latest"
target="_blank"
alt="Install Size"
/></a>
At **0.7.8**, this library got tuned to be more smaller, so it provides **5** different
bundling options.
## With Npm
```sh
# Npm
npm install --save axios axios-cache-interceptor
# Yarn
yarn add axios axios-cache-interceptor
```
```js
const { setupCache } = require('axios-cache-interceptor');
import { setupCache } from 'axios-cache-interceptor';
```
## With CDNs
```js
const { setupCache } = window.AxiosCacheInterceptor;
```
<!-- https://www.jsdelivr.com/package/npm/axios-cache-interceptor?path=dist -->
```html
<!-- Replace latest with the desired version -->
<!-- Development for ES2020+ (~31KB) -->
<script
src="https://cdn.jsdelivr.net/npm/axios-cache-interceptor@0.8.0-beta1/dist/index.development.js"
integrity="sha256-3tvTnjduX0P7n9c1ljTHgTH9h5MjLARrQcpapjGMxHQ="
crossorigin="anonymous"
></script>
<!-- Production for ES6+ (~11KB) -->
<script
src="https://cdn.jsdelivr.net/npm/axios-cache-interceptor@0.8.0-beta1/dist/index.min.js"
integrity="sha256-XT6/fu6h4cR9SpFiC7aUDcEyF2iBfSVPy5mNnAd1hTE="
crossorigin="anonymous"
></script>
<!-- Production for ES5+ (~19KB) -->
<script
src="https://cdn.jsdelivr.net/npm/axios-cache-interceptor@0.8.0-beta1/dist/index.es5.min.js"
integrity="sha256-KlR8DaezfVwSUZ+Umb5Yrj10Yrl5hDC8fl66WQga0KE="
crossorigin="anonymous"
></script>
<!-- Production for ES2020+ (~9KB) -->
<script
src="https://cdn.jsdelivr.net/npm/axios-cache-interceptor@0.8.0-beta1/dist/index.es2020.min.js"
integrity="sha256-1YXEQbH9lwGpMevsMh623Bm70Ao9U7qIdJnuYzOQ25E="
crossorigin="anonymous"
></script>
```
## With URL imports
You can import any [CDN Url](#with-cdns) and use it in your code. **UMD Compatible**
```js
import { setupCache } from 'https://cdn.jsdelivr.net/npm/axios-cache-interceptor@0.8.0-beta1/dist/index.es2020.min.js';
```
## Support List
Below you can check what version of this package is supported by your version of axios.
But that does not mean that won't work with any version. **Most of "breaking changes" made
by axios was it's types.**
> **NOTE**: Below v0.3, axios was not configured as a peer dependency
| [Version](https://github.com/arthurfiorette/axios-cache-interceptor/releases) | [Axios](https://github.com/axios/axios/releases) |
| ----------------------------------------------------------------------------- | ------------------------------------------------ |
| `>= v0.5` | `>= v0.24` |
| `~ v0.4` | `>= v0.23` |
| `~ v0.3` | `>= v0.22` |
| `<= v0.2` | `v0.21` |