UNPKG

redux-user-timing

Version:
1 lines 1.12 kB
{"version":3,"file":"index.mjs","sources":["../src/index.js"],"sourcesContent":["const middleware = () => next => action => {\n if (!performance || !performance.mark) {\n return next(action);\n }\n\n if (\n typeof action !== 'object' ||\n !action.type ||\n typeof action.type !== 'string'\n ) {\n // eslint-disable-next-line no-console\n console.error(\n 'Warning: action type is not valid. Performance measurement is not working properly.',\n );\n return next(action);\n }\n\n performance.mark(`${action.type}_START`);\n const result = next(action);\n performance.mark(`${action.type}_END`);\n performance.measure(\n `${action.type}`,\n `${action.type}_START`,\n `${action.type}_END`,\n );\n return result;\n};\n\nexport default middleware;\n"],"names":["next","action","performance","mark","type","console","error","result","measure"],"mappings":"0CAAyBA,mBAAQC,OAC1BC,cAAgBA,YAAYC,YACxBH,EAAKC,MAIM,iBAAXA,IACNA,EAAOG,MACe,iBAAhBH,EAAOG,YAGdC,QAAQC,MACN,uFAEKN,EAAKC,GAGdC,YAAYC,KAAQF,qBACdM,EAASP,EAAKC,UACpBC,YAAYC,KAAQF,eACpBC,YAAYM,WACPP,EAAY,KACZA,gBACAA,eAEEM"}