https://github.com/princed/storage-mock
Web Storage API Mock with events support
https://github.com/princed/storage-mock
events localstorage mock sessionstorage webstorage
Last synced: 9 months ago
JSON representation
Web Storage API Mock with events support
- Host: GitHub
- URL: https://github.com/princed/storage-mock
- Owner: princed
- License: mit
- Created: 2017-04-12T14:55:09.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2021-03-09T20:54:40.000Z (over 5 years ago)
- Last Synced: 2025-01-19T22:48:13.662Z (over 1 year ago)
- Topics: events, localstorage, mock, sessionstorage, webstorage
- Language: JavaScript
- Homepage:
- Size: 117 KB
- Stars: 0
- Watchers: 0
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: license
Awesome Lists containing this project
README
# storage-mock [](https://travis-ci.com/princed/storage-mock)
> Web Storage API Mock with events support
## Install
```
$ npm install --save storage-mock
```
## Usage
```js
const mockedWindow = require('storage-mock');
mockedWindow.addEventListener('storage', e => {
e.key // item-key
e.oldValue // null
e.newValue // item-value
});
mockedWindow.localStorage.setItem('item-key', 'item-value');
```
## License
MIT © Eugene Datsky