(initial_value, immutable = false, trackable = true)
| 115 | */ |
| 116 | /*#__NO_SIDE_EFFECTS__*/ |
| 117 | export 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 |
no test coverage detected