env.ts — vue Source File
Architecture documentation for env.ts, a typescript file in the vue codebase. 0 imports, 4 dependents.
Entity Profile
Dependency Diagram
graph LR aa2b6238_64b5_d2a0_65ca_67fd6aa3bf04["env.ts"] 88dc54e4_4a50_ce50_5fb5_52118613323e["error.ts"] 88dc54e4_4a50_ce50_5fb5_52118613323e --> aa2b6238_64b5_d2a0_65ca_67fd6aa3bf04 bf792703_842a_50eb_c357_a2c1c61e235e["next-tick.ts"] bf792703_842a_50eb_c357_a2c1c61e235e --> aa2b6238_64b5_d2a0_65ca_67fd6aa3bf04 395cc6b0_6f88_f1b1_f5dd_8cdf5c229777["options.ts"] 395cc6b0_6f88_f1b1_f5dd_8cdf5c229777 --> aa2b6238_64b5_d2a0_65ca_67fd6aa3bf04 f4608dd9_26eb_0122_6979_8fe915792d8a["perf.ts"] f4608dd9_26eb_0122_6979_8fe915792d8a --> aa2b6238_64b5_d2a0_65ca_67fd6aa3bf04 style aa2b6238_64b5_d2a0_65ca_67fd6aa3bf04 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
// can we use __proto__?
export const hasProto = '__proto__' in {}
// Browser environment sniffing
export const inBrowser = typeof window !== 'undefined'
export const UA = inBrowser && window.navigator.userAgent.toLowerCase()
export const isIE = UA && /msie|trident/.test(UA)
export const isIE9 = UA && UA.indexOf('msie 9.0') > 0
export const isEdge = UA && UA.indexOf('edge/') > 0
export const isAndroid = UA && UA.indexOf('android') > 0
export const isIOS = UA && /iphone|ipad|ipod|ios/.test(UA)
export const isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge
export const isPhantomJS = UA && /phantomjs/.test(UA)
export const isFF = UA && UA.match(/firefox\/(\d+)/)
// Firefox has a "watch" function on Object.prototype...
// @ts-expect-error firebox support
export const nativeWatch = {}.watch
export let supportsPassive = false
if (inBrowser) {
try {
const opts = {}
Object.defineProperty(opts, 'passive', {
get() {
/* istanbul ignore next */
supportsPassive = true
}
} as object) // https://github.com/facebook/flow/issues/285
window.addEventListener('test-passive', null as any, opts)
} catch (e: any) {}
}
// this needs to be lazy-evaled because vue may be required before
// vue-server-renderer can set VUE_ENV
let _isServer
export const isServerRendering = () => {
if (_isServer === undefined) {
/* istanbul ignore if */
if (!inBrowser && typeof global !== 'undefined') {
// detect presence of vue-server-renderer and avoid
// Webpack shimming the process
_isServer =
global['process'] && global['process'].env.VUE_ENV === 'server'
} else {
_isServer = false
}
}
return _isServer
}
// detect devtools
export const devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__
/* istanbul ignore next */
export function isNative(Ctor: any): boolean {
return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
}
export const hasSymbol =
typeof Symbol !== 'undefined' &&
isNative(Symbol) &&
typeof Reflect !== 'undefined' &&
isNative(Reflect.ownKeys)
let _Set // $flow-disable-line
/* istanbul ignore if */ if (typeof Set !== 'undefined' && isNative(Set)) {
// use native Set when available.
_Set = Set
} else {
// a non-standard Set polyfill that only works with primitive keys.
_Set = class Set implements SimpleSet {
set: Record<string, boolean> = Object.create(null)
has(key: string | number) {
return this.set[key] === true
}
add(key: string | number) {
this.set[key] = true
}
clear() {
this.set = Object.create(null)
}
}
}
export interface SimpleSet {
has(key: string | number): boolean
add(key: string | number): any
clear(): void
}
export { _Set }
Domain
Subdomains
Functions
Types
Imported By
Source
Frequently Asked Questions
What does env.ts do?
env.ts is a source file in the vue codebase, written in typescript. It belongs to the VueCore domain, Observer subdomain.
What functions are defined in env.ts?
env.ts defines 2 function(s): isNative, isServerRendering.
What files import env.ts?
env.ts is imported by 4 file(s): error.ts, next-tick.ts, options.ts, perf.ts.
Where is env.ts in the architecture?
env.ts is located at src/core/util/env.ts (domain: VueCore, subdomain: Observer, directory: src/core/util).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free