Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sturdynut/storagepoly
A polyfill for localStorage and sessionStorage for those times when they're undefined.
https://github.com/sturdynut/storagepoly
Last synced: 8 days ago
JSON representation
A polyfill for localStorage and sessionStorage for those times when they're undefined.
- Host: GitHub
- URL: https://github.com/sturdynut/storagepoly
- Owner: sturdynut
- License: mit
- Created: 2018-09-01T15:44:16.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2018-09-01T19:47:30.000Z (about 6 years ago)
- Last Synced: 2024-10-30T14:49:33.170Z (21 days ago)
- Language: JavaScript
- Size: 74.2 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Storage Poly | [![CircleCI](https://circleci.com/gh/sturdynut/storagePoly/tree/master.svg?style=svg&circle-token=c75d9cef31f5d841ff8201af2923ade3e7500602)](https://circleci.com/gh/sturdynut/storagePoly/tree/master) [![Coverage Status](https://coveralls.io/repos/github/sturdynut/storagePoly/badge.svg?branch=master)](https://coveralls.io/github/sturdynut/storagePoly?branch=master)
A polyfill for localStorage and sessionStorage for those times when they're undefined.
## Requirements
* Node 6+
## Install
`yarn add storagepoly` or `npm install storagepoly -S`
## Usage
```javascript
import 'storagepoly'; // or require('storagepoly')// Setting
localStorage.setItem('myItem', 'My stored value');// Getting
const myItem = localStorage.getItem('myItem');// Removing
localStorage.removeItem('myItem');// Clearing
localStorage.clear();```
## API
* `localStorage`: Mirrors api of `window.localStorage` [DOCS](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage)
* `sessionStorage`: Mirrors api of `window.sessionStorage` [DOCS](https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage)## Questions?
[@sturdynut](https://twitter.com/sturdynut)
## Bugs?
[Submit a bug](https://github.com/sturdynut/storagepoly/issues)
## License
This project is distributed under the MIT license.