fix: do not usre mark but direct time

This commit is contained in:
Daniel Roe 2024-11-14 21:27:43 +01:00
parent 01de9c3889
commit b0577a6bb5
No known key found for this signature in database
GPG Key ID: CBC814C393D93268

View File

@ -5,12 +5,15 @@ export default defineNuxtPlugin({
enforce: 'pre', enforce: 'pre',
setup (nuxtApp) { setup (nuxtApp) {
nuxtApp.hooks.beforeEach((event) => { nuxtApp.hooks.beforeEach((event) => {
performance.mark(event.name + ' start') // @ts-expect-error __startTime is not a public API
event.__startTime = performance.now()
}) })
// After each
nuxtApp.hooks.afterEach((event) => { nuxtApp.hooks.afterEach((event) => {
performance.measure(event.name, { performance.measure(event.name, {
start: event.name + ' start', // @ts-expect-error __startTime is not a public API
start: event.__startTime,
detail: { detail: {
devtools: { devtools: {
dataType: 'track-entry', dataType: 'track-entry',