mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 13:20:31 +00:00
17 lines
519 B
JavaScript
17 lines
519 B
JavaScript
const round = number => Math.round(number * 100) / 100
|
|
const monitorReducerEnhancer = createStore => (
|
|
reducer,
|
|
initialState,
|
|
enhancer
|
|
) => {
|
|
const monitoredReducer = (state, action) => {
|
|
const start = performance.now()
|
|
const newState = reducer(state, action)
|
|
const end = performance.now()
|
|
const diff = round(end - start)
|
|
console.log('reducer process time:', diff)
|
|
return newState
|
|
}
|
|
return createStore(monitoredReducer, initialState, enhancer)
|
|
}
|
|
export default monitorReducerEnhancer |