MCPcopy
hub / github.com/vuejs/core / reactive

Function reactive

packages/reactivity/src/reactive.ts:87–99  ·  packages/reactivity/src/reactive.ts::reactive
(target: object)

Source from the content-addressed store, hash-verified

85export function reactive<T extends object>(target: T): Reactive<T>
86/*@__NO_SIDE_EFFECTS__*/
87export function reactive(target: object) {
88 class="cm">// if trying to observe a readonly proxy, return the readonly version.
89 if (isReadonly(target)) {
90 return target
91 }
92 return createReactiveObject(
93 target,
94 false,
95 mutableHandlers,
96 mutableCollectionHandlers,
97 reactiveMap,
98 )
99}
100
101class="cm">// Use a private class brand instead of a marker property so shallow-reactive
102class="cm">// types remain distinguishable in `UnwrapRef` without leaking the brand into

Callers 15

getMethod · 0.90
computed.spec.tsFile · 0.90
reactive.spec.tsFile · 0.90
assertValueFunction · 0.90
readonly.spec.tsFile · 0.90
WeakSet.spec.tsFile · 0.90
coverCollectionFnFunction · 0.90
Map.spec.tsFile · 0.90
coverCollectionFnFunction · 0.90

Calls 2

isReadonlyFunction · 0.85
createReactiveObjectFunction · 0.85

Tested by 7

assertValueFunction · 0.72
coverCollectionFnFunction · 0.72
coverCollectionFnFunction · 0.72
setupFunction · 0.72
assertTriggerRefFunction · 0.68
testRenderFunction · 0.68
assertCssVarsFunction · 0.68