mirror of
https://github.com/reduxjs/redux-devtools.git
synced 2025-04-26 11:13:43 +03:00
* Move background to top-level * Move devpanel to top-level * Move devtools to top-level * Move options to top-level * Move window to top-level * Move chromeApiMock to top-level * Move manifests to top-level * Move contentScript to top-level * Move pageScript to top-level * Update tests * Update Webpack config * Fix path
29 lines
937 B
TypeScript
29 lines
937 B
TypeScript
import { createStore, applyMiddleware, Reducer } from 'redux';
|
|
import localForage from 'localforage';
|
|
import { persistReducer, persistStore } from 'redux-persist';
|
|
import { exportStateMiddleware, StoreAction } from '@redux-devtools/app';
|
|
import panelDispatcher from './panelSyncMiddleware';
|
|
import rootReducer, { StoreStateWithoutSocket } from './panelReducer';
|
|
|
|
const persistConfig = {
|
|
key: 'redux-devtools',
|
|
blacklist: ['instances', 'socket'],
|
|
storage: localForage,
|
|
};
|
|
|
|
const persistedReducer: Reducer<StoreStateWithoutSocket, StoreAction> =
|
|
persistReducer(persistConfig, rootReducer) as any;
|
|
|
|
export default function configureStore(
|
|
position: string,
|
|
bgConnection: chrome.runtime.Port
|
|
) {
|
|
const enhancer = applyMiddleware(
|
|
exportStateMiddleware,
|
|
panelDispatcher(bgConnection)
|
|
);
|
|
const store = createStore(persistedReducer, enhancer);
|
|
const persistor = persistStore(store);
|
|
return { store, persistor };
|
|
}
|