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 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 mbeaudru commented May 7, 2019

I second this, very useful middleware !

@yoerivdm

This comment has been minimized.

Copy link

@yoerivdm yoerivdm commented May 5, 2020

Thanks! Exactly what I need :-)

@clarkbw

This comment has been minimized.

Copy link
Owner Author

@clarkbw clarkbw commented May 5, 2020

Wow, thanks! I’d never seen these comments before 🤩

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.