mirror of https://github.com/vuejs/core.git
fix(devtools): allow setting devtools hook after createApp (#13580)
This commit is contained in:
parent
a5379e23f5
commit
6dc07a8922
|
@ -49,11 +49,7 @@ function emit(event: string, ...args: any[]) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let queued = false
|
|
||||||
export function setDevtoolsHook(hook: DevtoolsHook, target: any): void {
|
export function setDevtoolsHook(hook: DevtoolsHook, target: any): void {
|
||||||
if (devtoolsNotInstalled || queued) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
devtools = hook
|
devtools = hook
|
||||||
if (devtools) {
|
if (devtools) {
|
||||||
devtools.enabled = true
|
devtools.enabled = true
|
||||||
|
@ -70,7 +66,6 @@ export function setDevtoolsHook(hook: DevtoolsHook, target: any): void {
|
||||||
// eslint-disable-next-line no-restricted-syntax
|
// eslint-disable-next-line no-restricted-syntax
|
||||||
!window.navigator?.userAgent?.includes('jsdom')
|
!window.navigator?.userAgent?.includes('jsdom')
|
||||||
) {
|
) {
|
||||||
queued = true
|
|
||||||
const replay = (target.__VUE_DEVTOOLS_HOOK_REPLAY__ =
|
const replay = (target.__VUE_DEVTOOLS_HOOK_REPLAY__ =
|
||||||
target.__VUE_DEVTOOLS_HOOK_REPLAY__ || [])
|
target.__VUE_DEVTOOLS_HOOK_REPLAY__ || [])
|
||||||
replay.push((newHook: DevtoolsHook) => {
|
replay.push((newHook: DevtoolsHook) => {
|
||||||
|
|
Loading…
Reference in New Issue