Home / Function/ proxyWithRefUnwrap() — vue Function Reference

proxyWithRefUnwrap() — vue Function Reference

Architecture documentation for the proxyWithRefUnwrap() function in ref.ts from the vue codebase.

Entity Profile

Dependency Diagram

graph TD
  0dff7671_dbca_28ee_2e55_169d9e03ef4c["proxyWithRefUnwrap()"]
  87ac0b39_9319_5c07_1390_906641a5c4fe["initSetup()"]
  87ac0b39_9319_5c07_1390_906641a5c4fe -->|calls| 0dff7671_dbca_28ee_2e55_169d9e03ef4c
  6827e187_9a52_5423_0fdc_05675ae269f2["createSetupContext()"]
  6827e187_9a52_5423_0fdc_05675ae269f2 -->|calls| 0dff7671_dbca_28ee_2e55_169d9e03ef4c
  64e66d4a_66ec_04dc_9d39_9163e6c96fe5["proxyRefs()"]
  64e66d4a_66ec_04dc_9d39_9163e6c96fe5 -->|calls| 0dff7671_dbca_28ee_2e55_169d9e03ef4c
  1cb75796_39e2_4190_8602_3712ff6cf2f7["isRef()"]
  0dff7671_dbca_28ee_2e55_169d9e03ef4c -->|calls| 1cb75796_39e2_4190_8602_3712ff6cf2f7
  3e3c4a43_0494_5d27_e47e_6cc391330201["depend()"]
  0dff7671_dbca_28ee_2e55_169d9e03ef4c -->|calls| 3e3c4a43_0494_5d27_e47e_6cc391330201
  style 0dff7671_dbca_28ee_2e55_169d9e03ef4c fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/v3/reactivity/ref.ts lines 111–138

export function proxyWithRefUnwrap(
  target: any,
  source: Record<string, any>,
  key: string
) {
  Object.defineProperty(target, key, {
    enumerable: true,
    configurable: true,
    get: () => {
      const val = source[key]
      if (isRef(val)) {
        return val.value
      } else {
        const ob = val && val.__ob__
        if (ob) ob.dep.depend()
        return val
      }
    },
    set: value => {
      const oldValue = source[key]
      if (isRef(oldValue) && !isRef(value)) {
        oldValue.value = value
      } else {
        source[key] = value
      }
    }
  })
}

Domain

Subdomains

Frequently Asked Questions

What does proxyWithRefUnwrap() do?
proxyWithRefUnwrap() is a function in the vue codebase.
What does proxyWithRefUnwrap() call?
proxyWithRefUnwrap() calls 2 function(s): depend, isRef.
What calls proxyWithRefUnwrap()?
proxyWithRefUnwrap() is called by 3 function(s): createSetupContext, initSetup, proxyRefs.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free