mirror of
https://github.com/nolanlawson/pinafore
synced 2024-12-11 09:45:24 +01:00
20 lines
411 B
JavaScript
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}`)
|
|
}
|
|
}
|