mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 13:50:31 +00:00
WIP Frontend structure & authentication.
This commit is contained in:
17
client/src/store/enhancers/monitorReducer.js
Normal file
17
client/src/store/enhancers/monitorReducer.js
Normal file
@@ -0,0 +1,17 @@
|
||||
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
|
||||
Reference in New Issue
Block a user