1.2.1 • Published 4 years ago

memfetch v1.2.1

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

memfetch

An unobtrusive development library for caching and returning fetch requests.

The concept is that the library is included for development to reduce external API requests (particularly around rate-limiting) and to reduce latency, whilst making it easy to remove the library when ready for development.

Usage

You can include the library via an npm install, or I'd recommend a simple script include:

<script src="https://unpkg.com/memfetch"></script>

As long the script is before your own code, all requests using fetch will be cached and served via IndexedDB subsequently.

Only caching specific URLs

Since memfetch doesn't play nicely with things like Hot Module Reload, you can specify to only allow memfetch to handle matching URLs. To do so, include a string fragment in the query string of the script include. This method (below) will cache any URL that includes api in the string:

<script src="https://unpkg.com/memfetch?api"></script>

Clearing / resetting the cache

The memfetch wrapper also provides a property called seed. Upon setting the value, or changing it (between sessions) will completely empty the cache.

License

1.2.0

4 years ago

1.2.1

4 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.0

5 years ago