redux-localstorage
Advanced tools
Comparing version 0.4.0 to 0.4.1
@@ -16,2 +16,4 @@ 'use strict'; | ||
var _utilTypeOfJs2 = _interopRequireDefault(_utilTypeOfJs); | ||
/** | ||
@@ -26,4 +28,2 @@ * @description | ||
var _utilTypeOfJs2 = _interopRequireDefault(_utilTypeOfJs); | ||
function createSlicer(paths) { | ||
@@ -30,0 +30,0 @@ switch ((0, _utilTypeOfJs2['default'])(paths)) { |
@@ -19,2 +19,4 @@ 'use strict'; | ||
var _utilMergeStateJs2 = _interopRequireDefault(_utilMergeStateJs); | ||
/** | ||
@@ -37,4 +39,2 @@ * @description | ||
var _utilMergeStateJs2 = _interopRequireDefault(_utilMergeStateJs); | ||
function persistState(paths, config) { | ||
@@ -56,3 +56,8 @@ var cfg = _extends({ | ||
return function (next) { | ||
return function (reducer, initialState) { | ||
return function (reducer, initialState, enhancer) { | ||
if (typeof initialState === 'function' && typeof enhancer === 'undefined') { | ||
enhancer = initialState; | ||
initialState = undefined; | ||
} | ||
var persistedState = undefined; | ||
@@ -68,3 +73,3 @@ var finalInitialState = undefined; | ||
var store = next(reducer, finalInitialState); | ||
var store = next(reducer, finalInitialState, enhancer); | ||
var slicerFn = slicer(paths); | ||
@@ -71,0 +76,0 @@ |
{ | ||
"name": "redux-localstorage", | ||
"version": "0.4.0", | ||
"version": "0.4.1", | ||
"description": "Store enhancer that syncs (a subset of) your redux store state to localstorage.", | ||
@@ -5,0 +5,0 @@ "main": "lib/persistState.js", |
@@ -6,3 +6,3 @@ redux-localstorage | ||
Redux-localstorage includes support for [immutable collections](#immutable-data). Support for React Native's AsyncStorage is coming; watch this space. | ||
**NOTE:** Be sure to check out the [1.0-breaking-changes](https://github.com/elgerlambert/redux-localstorage/tree/1.0-breaking-changes) branch (available on npm as `redux-localstorage@rc`). It includes support for flexible storage backends, including (but not limited to) `sessionStorage` and react-natives' `AsyncStorage`. | ||
@@ -19,8 +19,8 @@ ## Installation | ||
const createPersistentStore = compose( | ||
const enhancer = compose( | ||
/* [middlewares] */, | ||
persistState(/*paths, config*/), | ||
createStore | ||
) | ||
const store = createPersistentStore(/*reducer, initialState*/) | ||
const store = createStore(/*reducer, [initialState]*/, enhancer) | ||
``` | ||
@@ -71,3 +71,3 @@ | ||
## Immutable Data | ||
If you're using immutable collections or some other custom collection, redux-localstorage exposes a number of functions that can be overridden by providing the following config options. These allow you to specify your own tranformations based on your needs. If your using ordinary javascript Objects, Arrays or primitives, you shouldn't have to concern yourself with these options. | ||
If you're using immutable collections or some other custom collection, redux-localstorage exposes a number of functions that can be overridden by providing the following config options. These allow you to specify your own transformations based on your needs. If you're using ordinary javascript Objects, Arrays or primitives, you shouldn't have to concern yourself with these options. | ||
@@ -74,0 +74,0 @@ ##### config.serialize |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13421
12
163