redux-local-save

1.0.3 • Public • Published

redux-local-save NPM version

Module for store state saving

Installation

$ npm install --save redux-local-save
import { createStore, applyMiddleware } from 'redux'
import createLocalSaveMiddleware, { loadStorage } from 'redux-local-save'

//Create middleware for installation.
const localSaveMiddleware = createLocalSaveMiddleware({
        //We specify actions which will start saving
        saveActions: [
            TEST_SAVE,
            //Debounce: each call defers saving to 300ms
            { type: TEST_SAVE_WITH_DEBOUNCE, debounce: 300 },
            //Throttle: call no more than 200ms
            { type: TEST_SAVE_WITH_THROTTLE, throttle: 200 }
        ]
    })

const store = createStore(
        reducer,
        //Load the saved state
        loadStorage(),
        applyMiddleware(localSaveMiddleware)
    )

License

MIT © jeckyhit

Package Sidebar

Install

npm i redux-local-save

Weekly Downloads

0

Version

1.0.3

License

MIT

Unpacked Size

21.2 kB

Total Files

11

Last publish

Collaborators

  • jeckyhit