https://github.com/kwhitley/localstorify
localStorage wrapper that adds automatic memory management
https://github.com/kwhitley/localstorify
Last synced: 23 days ago
JSON representation
localStorage wrapper that adds automatic memory management
- Host: GitHub
- URL: https://github.com/kwhitley/localstorify
- Owner: kwhitley
- License: mit
- Created: 2019-04-19T15:33:24.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2019-05-15T20:32:16.000Z (almost 6 years ago)
- Last Synced: 2024-04-14T05:46:36.623Z (about 1 year ago)
- Language: JavaScript
- Size: 149 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
localStorage that avoids storage limit failures
===# Why?
Because localStorage is great, but extremely limited in functionality and robustness. This library adds:
- [x] automatic garbage collection and limit detection (no failures on persistence)# Installation
```
yarn add -D @kwhitley/localstorify
```# Usage
Simply replace references to `localStorage` with the the export of this library.```js
import localstorify from '@kwhitley/localstorify'// replace
localStorage.getItem('foo')
// with
localstorify.getItem('foo')...
// or
localStorage.setItem('foo', JSON.stringify({ foo: 'bar' }))
// with
localstorify.setItem('foo', JSON.stringify({ foo: 'bar' }))
```