Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
A User Timing middleware for redux to create performance markers for dispatched actions
const timing = store => next => action => {
performance.mark(`${action.type}_start`);
let result = next(action);
performance.mark(`${action.type}_end`);
performance.measure(
`${action.type}`,
`${action.type}_start`,
`${action.type}_end`
);
return result;
};
@vcarl

This comment has been minimized.

Copy link

vcarl commented Jun 10, 2018

Wanted to thank you for this! Popped up first when I googled "user timing api redux" and worked flawlessly.

@mbeaudru

This comment has been minimized.

Copy link

mbeaudru commented May 7, 2019

I second this, very useful middleware !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.