-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
/
Copy pathenv.ts
28 lines (23 loc) · 812 Bytes
/
env.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import type { ApiProxy } from './proxy.js'
import type { PluginDescriptor, SetupFunction } from './index.js'
export interface PluginQueueItem {
pluginDescriptor: PluginDescriptor
setupFn: SetupFunction
proxy?: ApiProxy
}
interface GlobalTarget {
__VUE_DEVTOOLS_PLUGINS__?: PluginQueueItem[]
__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__?: boolean
}
export function getDevtoolsGlobalHook(): any {
return (getTarget() as any).__VUE_DEVTOOLS_GLOBAL_HOOK__
}
export function getTarget(): GlobalTarget {
// @ts-expect-error navigator and windows are not available in all environments
return (typeof navigator !== 'undefined' && typeof window !== 'undefined')
? window
: typeof globalThis !== 'undefined'
? globalThis
: {}
}
export const isProxyAvailable = typeof Proxy === 'function'