-
-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(kit): respect legacy devtools plugin registration
- Loading branch information
1 parent
813a544
commit f7941e6
Showing
4 changed files
with
35 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { target } from '@vue/devtools-shared' | ||
|
||
// devtools <= 6.x | ||
export function isLegacyVueDevTools() { | ||
return +(target.__VUE_DEVTOOLS_GLOBAL_HOOK__.devtoolsVersion?.[0] ?? 0) < 7 | ||
} | ||
|
||
export function onLegacyDevToolsPluginApiAvailabled(cb: () => void) { | ||
if (target.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__) { | ||
cb() | ||
return | ||
} | ||
// eslint-disable-next-line accessor-pairs | ||
Object.defineProperty(target, '__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__', { | ||
set(value) { | ||
if (value) | ||
cb() | ||
}, | ||
configurable: true, | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters