gr2m / gr2m/localstorage-memory
Unable to create multiple instances
- Dominant language
- JavaScript
- Stars
- 26
- Forks
- 6
- PR merge metrics
- No merged PRs in 30d
Description
Would you be open to a PR that enabled multiple instances?
The API for localstorage and sessionstorage is identical. We're using this module in for our node test suite to mock out local and session storage. However, because this module acts as a singleton, we can't create separate stores (one to mock localStorage and another for sessionStorage).
Changing up the api of this so that it's possible to instantiate any number of stores would be greatly beneficial.
Something like:
``` js
var Storage = require('localstorage-memory');
var localStorage = new Storage();
var sessionStorage = new Storage();
localStorage.setItem('foo', 'bar');
sessionStorage.getItem('foo'); // -> undefined
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.