core-dashboard-worona
Advanced tools
Comparing version 1.3.22 to 1.3.23
{ | ||
"name": "core-dashboard-worona", | ||
"version": "1.3.22", | ||
"version": "1.3.23", | ||
"description": "Core Package of Worona Dashboard", | ||
@@ -39,4 +39,5 @@ "scripts": { | ||
"redux-devtools-extension": "^1.0.0", | ||
"redux-logger": "^2.8.2", | ||
"systemjs": "^0.19.39" | ||
} | ||
} |
@@ -0,1 +1,2 @@ | ||
/* eslint-disable no-console */ | ||
import { combineReducers } from 'redux'; | ||
@@ -2,0 +3,0 @@ import assets from './assets'; |
/* eslint-disable global-require */ | ||
/* global window */ | ||
import { createStore, applyMiddleware, combineReducers } from 'redux'; | ||
import createSagaMiddleware from 'redux-saga'; | ||
import { isTest } from 'worona-deps'; | ||
import { reduxReactRouter, routerStateReducer as router } from 'redux-router'; | ||
import { composeWithDevTools } from 'redux-devtools-extension'; | ||
import build from '../reducers'; | ||
import { createStore, applyMiddleware, combineReducers } from "redux"; | ||
import createSagaMiddleware from "redux-saga"; | ||
import createLogger from "redux-logger"; | ||
import { isTest, isDev } from "worona-deps"; | ||
import { reduxReactRouter, routerStateReducer as router } from "redux-router"; | ||
import { composeWithDevTools } from "redux-devtools-extension"; | ||
import build from "../reducers"; | ||
const sagaMiddleware = createSagaMiddleware(); | ||
const loggerMiddleware = createLogger({ | ||
collapsed: true, | ||
diff: true, | ||
timestamp: false, | ||
}); | ||
const middleware = isDev | ||
? [sagaMiddleware, loggerMiddleware] | ||
: [sagaMiddleware]; | ||
const reducers = { build: build(), router }; | ||
const sagas = {}; | ||
const composeEnhancers = composeWithDevTools({ | ||
serialize: false, | ||
}); | ||
const composeEnhancers = composeWithDevTools({ serialize: false }); | ||
@@ -23,5 +31,7 @@ export const store = createStore( | ||
reduxReactRouter({ | ||
createHistory: !isTest ? require('history').createHistory : require('history').createMemoryHistory, | ||
createHistory: !isTest | ||
? require("history").createHistory | ||
: require("history").createMemoryHistory, | ||
}), | ||
applyMiddleware(sagaMiddleware), | ||
applyMiddleware(...middleware) | ||
) | ||
@@ -33,8 +43,17 @@ ); | ||
export const dispatch = action => store.dispatch(action); | ||
export const reloadReducers = () => store.replaceReducer(combineReducers(reducers)); | ||
export const addReducer = (namespace, reducer) => { if (reducer) reducers[namespace] = reducer; }; | ||
export const removeReducer = namespace => { if (reducers[namespace]) delete reducers[namespace]; }; | ||
export const startSaga = (namespace, saga) => { sagas[namespace] = sagaMiddleware.run(saga); }; | ||
export const stopSaga = (namespace) => { if (sagas[namespace]) sagas[namespace].cancel(); }; | ||
export const reloadReducers = () => | ||
store.replaceReducer(combineReducers(reducers)); | ||
export const addReducer = (namespace, reducer) => { | ||
if (reducer) reducers[namespace] = reducer; | ||
}; | ||
export const removeReducer = namespace => { | ||
if (reducers[namespace]) delete reducers[namespace]; | ||
}; | ||
export const startSaga = (namespace, saga) => { | ||
sagas[namespace] = sagaMiddleware.run(saga); | ||
}; | ||
export const stopSaga = namespace => { | ||
if (sagas[namespace]) sagas[namespace].cancel(); | ||
}; | ||
export const getState = store.getState.bind(store); | ||
export const history = store.history; |
59239
1202
4
+ Addedredux-logger@^2.8.2
+ Addeddeep-diff@0.3.4(transitive)
+ Addedredux-logger@2.10.2(transitive)