1 | /**
|
2 | @license
|
3 | Copyright (c) 2018 The Polymer Project Authors. All rights reserved.
|
4 | This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
5 | The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
6 | The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
7 | Code distributed by Google as part of the polymer project is also
|
8 | subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
9 | */
|
10 | import { ReducersMapObject, StoreEnhancer } from 'redux';
|
11 | export interface LazyStore {
|
12 | addReducers: (newReducers: ReducersMapObject) => void;
|
13 | }
|
14 | /**
|
15 | A Redux store enhancer that lets you lazy-install reducers after the store
|
16 | has booted up. Use this if your application lazy-loads routes that are connected
|
17 | to a Redux store.
|
18 |
|
19 | Example:
|
20 |
|
21 | import { combineReducers } from 'redux';
|
22 | import { lazyReducerEnhancer } from 'pwa-helpers/lazy-reducer-enhancer.js';
|
23 | import someReducer from './reducers/someReducer.js';
|
24 |
|
25 | export const store = createStore(
|
26 | (state, action) => state,
|
27 | compose(lazyReducerEnhancer(combineReducers))
|
28 | );
|
29 |
|
30 | Then, in your page/element, you can lazy load a specific reducer with:
|
31 |
|
32 | store.addReducers({
|
33 | someReducer
|
34 | });
|
35 | */
|
36 | export declare const lazyReducerEnhancer: (combineReducers: typeof import("redux").combineReducers) => StoreEnhancer<LazyStore, {}>;
|