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

Function mutable_source

packages/svelte/src/internal/client/reactivity/sources.js:117–130  ·  view source on GitHub ↗
(initial_value, immutable = false, trackable = true)

Source from the content-addressed store, hash-verified

115 */
116/*#__NO_SIDE_EFFECTS__*/
117export function mutable_source(initial_value, immutable = false, trackable = true) {
118 const s = source(initial_value);
119 if (!immutable) {
120 s.equals = safe_equals;
121 }
122
123 // bind the signal to the component context, in case we need to
124 // track updates to trigger beforeUpdate/afterUpdate callbacks
125 if (legacy_mode_flag && trackable && component_context !== null && component_context.l !== null) {
126 (component_context.l.s ??= []).push(s);
127 }
128
129 return s;
130}
131
132/**
133 * @template V

Callers 4

add_sourceMethod · 0.90
create_itemFunction · 0.90
await_blockFunction · 0.90
store_getFunction · 0.90

Calls 2

sourceFunction · 0.85
pushMethod · 0.80

Tested by

no test coverage detected