Created
March 30, 2019 00:27
-
-
Save craigbeck/7653ff264753b14bd8f30e1e16e0bf05 to your computer and use it in GitHub Desktop.
redux profile middleware
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const profileMiddleware = _ => { | |
console.log('%cINSTALLED profileMiddleware', 'color:magenta'); | |
return next => action => { | |
if (typeof action.then === 'function') { | |
return next(action); | |
} | |
// eslint-disable-next-line no-console | |
console.group('dispatch ' + action.type); | |
console.time(action.type); | |
const result = next(action); | |
// eslint-disable-next-line no-console | |
console.timeEnd(action.type); | |
console.log(action); | |
console.groupEnd('dispatch ' + action.type); | |
return next(result); | |
}; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment