Home / Function/ provide() — vue Function Reference

provide() — vue Function Reference

Architecture documentation for the provide() function in apiInject.ts from the vue codebase.

Entity Profile

Dependency Diagram

graph TD
  edf6e84a_a9b3_f218_50da_70c66a6fd2b4["provide()"]
  83b69f04_ff47_67cf_7f1c_542b323e1eb5["apiInject.ts"]
  edf6e84a_a9b3_f218_50da_70c66a6fd2b4 -->|defined in| 83b69f04_ff47_67cf_7f1c_542b323e1eb5
  6d02ba8b_00f1_96e7_030f_48516ba393f8["resolveProvided()"]
  edf6e84a_a9b3_f218_50da_70c66a6fd2b4 -->|calls| 6d02ba8b_00f1_96e7_030f_48516ba393f8
  style edf6e84a_a9b3_f218_50da_70c66a6fd2b4 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/v3/apiInject.ts lines 7–16

export function provide<T>(key: InjectionKey<T> | string | number, value: T) {
  if (!currentInstance) {
    if (__DEV__) {
      warn(`provide() can only be used inside setup().`)
    }
  } else {
    // TS doesn't allow symbol as index type
    resolveProvided(currentInstance)[key as string] = value
  }
}

Domain

Subdomains

Defined In

Frequently Asked Questions

What does provide() do?
provide() is a function in the vue codebase, defined in src/v3/apiInject.ts.
Where is provide() defined?
provide() is defined in src/v3/apiInject.ts at line 7.
What does provide() call?
provide() calls 1 function(s): resolveProvided.

Analyze Your Own Codebase

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

Try Supermodel Free