Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

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