Skip to content

Instantly share code, notes, and snippets.

@jackyq2015
Forked from clarkbw/redux-performance-mark.js
Created December 14, 2019 01:02
Show Gist options
  • Save jackyq2015/81a900dc9348cfea8b99faeeee236847 to your computer and use it in GitHub Desktop.
Save jackyq2015/81a900dc9348cfea8b99faeeee236847 to your computer and use it in GitHub Desktop.
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;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment