1
0
mirror of https://github.com/nolanlawson/pinafore synced 2024-12-11 09:45:24 +01:00
Pinafore-Web-Client-Frontend/routes/_utils/marks.js
2018-03-09 00:08:23 -08:00

20 lines
411 B
JavaScript

const enabled = process.browser && performance.mark && (
process.env.NODE_ENV !== 'production' ||
location.search.includes('marks=true')
)
const perf = process.browser && performance
export function mark (name) {
if (enabled) {
perf.mark(`start ${name}`)
}
}
export function stop (name) {
if (enabled) {
perf.mark(`end ${name}`)
perf.measure(name, `start ${name}`, `end ${name}`)
}
}