Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: about 2 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 (over 7 years ago)
- Default Branch: master
- Last Pushed: 2021-03-09T20:54:40.000Z (almost 4 years ago)
- Last Synced: 2024-10-13T13:11:12.279Z (3 months 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 [![Build Status](https://travis-ci.com/princed/storage-mock.svg?branch=master)](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