https://github.com/jogboms/ngrx-restate
Persist @ngRx/Redux Store States on page reloads.
https://github.com/jogboms/ngrx-restate
Last synced: 7 months ago
JSON representation
Persist @ngRx/Redux Store States on page reloads.
- Host: GitHub
- URL: https://github.com/jogboms/ngrx-restate
- Owner: jogboms
- License: mit
- Created: 2016-11-03T01:51:59.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2016-11-13T23:28:23.000Z (almost 9 years ago)
- Last Synced: 2025-02-02T16:24:29.243Z (8 months ago)
- Language: TypeScript
- Homepage:
- Size: 4.88 KB
- Stars: 0
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ngrx-restate
NgRx-restate is a @ngrx/redux meta-reducer/middleware for persisting Store States on page reloads.
It currently supports only `localStorage` for now.Optional configuration.
```
const config = {
states: ['state_name', ..., 'more_state_names'],
storage: LocalStorage, // Default
delay: 5000
}
```
* `states` refers to an Array of state names within the store to persist. Defaults to all states.
* `storage` refers to storage means with which to persit this data. Defaults to `localStorage`.
* `delay` refer to the maximum throttle time (milliseconds) to persist states to storage. Defaults to 3500ms.Root reducer composition.
```
const RootReducer = compose(restate(config), combineReducers)({
'state_name': (state, action) => {},
...,
'more_state_names': (state, action) => {}
});
```Provide in Root App Module as,
```
StoreModule.provideStore(RootReducer);
```