MCPcopy Create free account
hub / github.com/Xu22Web/tech-study-js / watchRef

Function watchRef

tech-study.js:1280–1286  ·  view source on GitHub ↗
(source, callback)

Source from the content-addressed store, hash-verified

1278 * @returns
1279 */
1280const watchRef = (source, callback) => {
1281 // 收集依赖
1282 const effectRes = shallowRef(callback());
1283 // 监听
1284 watch(source, () => (effectRes.value = unref(callback())));
1285 return effectRes;
1286};
1287/**
1288 * @description 监听影响 ref
1289 * @param refVal

Callers 6

handleAttributeFunction · 0.70
TipFunction · 0.70
SelectFunction · 0.70
FrameFunction · 0.70
TaskBtnFunction · 0.70
PanelFunction · 0.70

Calls 3

shallowRefFunction · 0.70
watchFunction · 0.70
unrefFunction · 0.70

Tested by

no test coverage detected