Skip to content

Commit 26f1967

Browse files
committed
always use uid when calling performance.mark (fix vuejs#5209)
1 parent 2944515 commit 26f1967

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/core/instance/init.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,18 @@ let uid = 0
1414

1515
export function initMixin (Vue: Class<Component>) {
1616
Vue.prototype._init = function (options?: Object) {
17+
const vm: Component = this
18+
// a uid
19+
vm._uid = uid++
20+
1721
/* istanbul ignore if */
22+
let startTag, endTag
1823
if (process.env.NODE_ENV !== 'production' && config.performance && mark) {
19-
mark('vue-perf-init')
24+
startTag = `vue-perf-init:${vm._uid}`
25+
endTag = `vue-perf-end:${vm._uid}`
26+
mark(startTag)
2027
}
2128

22-
const vm: Component = this
23-
// a uid
24-
vm._uid = uid++
2529
// a flag to avoid this being observed
2630
vm._isVue = true
2731
// merge options
@@ -57,8 +61,8 @@ export function initMixin (Vue: Class<Component>) {
5761
/* istanbul ignore if */
5862
if (process.env.NODE_ENV !== 'production' && config.performance && mark) {
5963
vm._name = formatComponentName(vm, false)
60-
mark('vue-perf-init-end')
61-
measure(`${vm._name} init`, 'vue-perf-init', 'vue-perf-init-end')
64+
mark(endTag)
65+
measure(`${vm._name} init`, startTag, endTag)
6266
}
6367

6468
if (vm.$options.el) {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy