constructor() — vue Function Reference
Architecture documentation for the constructor() function in index.ts from the vue codebase.
Entity Profile
Dependency Diagram
graph TD 880c6a62_2aaa_589b_5776_d50c07b1b059["constructor()"] 4cc0bb10_4bb1_2181_7b32_ded7baee0a01["observeArray()"] 880c6a62_2aaa_589b_5776_d50c07b1b059 -->|calls| 4cc0bb10_4bb1_2181_7b32_ded7baee0a01 345b25ad_bb77_07cb_ecf5_8b82f12ddccd["defineReactive()"] 880c6a62_2aaa_589b_5776_d50c07b1b059 -->|calls| 345b25ad_bb77_07cb_ecf5_8b82f12ddccd ed6bde39_5ee1_e944_9968_4371147ae4c9["constructor()"] 880c6a62_2aaa_589b_5776_d50c07b1b059 -->|calls| ed6bde39_5ee1_e944_9968_4371147ae4c9 style 880c6a62_2aaa_589b_5776_d50c07b1b059 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
src/core/observer/index.ts lines 52–85
constructor(public value: any, public shallow = false, public mock = false) {
// this.value = value
this.dep = mock ? mockDep : new Dep()
this.vmCount = 0
def(value, '__ob__', this)
if (isArray(value)) {
if (!mock) {
if (hasProto) {
/* eslint-disable no-proto */
;(value as any).__proto__ = arrayMethods
/* eslint-enable no-proto */
} else {
for (let i = 0, l = arrayKeys.length; i < l; i++) {
const key = arrayKeys[i]
def(value, key, arrayMethods[key])
}
}
}
if (!shallow) {
this.observeArray(value)
}
} else {
/**
* Walk through all properties and convert them into
* getter/setters. This method should only be called when
* value type is Object.
*/
const keys = Object.keys(value)
for (let i = 0; i < keys.length; i++) {
const key = keys[i]
defineReactive(value, key, NO_INITIAL_VALUE, undefined, shallow, mock)
}
}
}
Domain
Subdomains
Source
Frequently Asked Questions
What does constructor() do?
constructor() is a function in the vue codebase.
What does constructor() call?
constructor() calls 3 function(s): constructor, defineReactive, observeArray.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free