Skip to content

Instantly share code, notes, and snippets.

@oieduardorabelo
Created January 11, 2019 10:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oieduardorabelo/af8ed588c90935d3e20422536f8dfc25 to your computer and use it in GitHub Desktop.
Save oieduardorabelo/af8ed588c90935d3e20422536f8dfc25 to your computer and use it in GitHub Desktop.
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