elgerlambert / redux-localstorage

Store enhancer that syncs (a subset) of your Redux store state to localstorage.
MIT License
1.32k stars 107 forks source link

default to window.localStorage instead of localStorage? #31

Closed Los83 closed 8 years ago

Los83 commented 8 years ago

When testing with mocha in circle ci leaving the defaults generates the following error ReferenceError: localStorage is not defined at Object. (node_modules/redux-localstorage/lib/persistState.js:29:61) which stubbing localStorage in mocha does not fix. Changing the localStorage line 29 to window.localStorage fixed the problem for me, but I had to do it in a fork. If there is any way you could use window.localStorage instead of the global localStorage or have localStorage default to window.localStorage or instruct me on a workaround, I would appreciate it. Thank you for the module