Created
July 6, 2018 16:38
-
-
Save ivan-hilckov/b1c4308f9a81303f059588fa46d999d7 to your computer and use it in GitHub Desktop.
Redux Profile Midelware
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 userTiming = () => (next) => (action) => { | |
if (performance.mark === undefined) return next(action); | |
performance.mark(`${action.type}_start`); | |
const result = next(action); | |
performance.mark(`${action.type}_end`); | |
performance.measure( | |
`${action.type}`, | |
`${action.type}_start`, | |
`${action.type}_end`, | |
); | |
return result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment