MCPcopy
hub / github.com/sveltejs/svelte / with_parent

Function with_parent

packages/svelte/src/internal/client/proxy.js:65–84  ·  view source on GitHub ↗
(fn)

Source from the content-addressed store, hash-verified

63 * @param {() => T} fn
64 */
65 var with_parent = (fn) => {
66 if (update_version === parent_version) {
67 return fn();
68 }
69
70 // child source is being created after the initial proxy —
71 // prevent it from being associated with the current reaction
72 var reaction = active_reaction;
73 var version = update_version;
74
75 set_active_reaction(null);
76 set_update_version(parent_version);
77
78 var result = fn();
79
80 set_active_reaction(reaction);
81 set_update_version(version);
82
83 return result;
84 };
85
86 if (is_proxied_array) {
87 // We need to create the length source eagerly to ensure that

Callers 5

definePropertyFunction · 0.85
deletePropertyFunction · 0.85
getFunction · 0.85
hasFunction · 0.85
setFunction · 0.85

Calls 3

set_active_reactionFunction · 0.90
set_update_versionFunction · 0.90
fnFunction · 0.50

Tested by

no test coverage detected