()
| 128 | * causes `b` to be registered as a dependency). |
| 129 | */ |
| 130 | export function capture() { |
| 131 | var previous_effect = /** @type {Effect} */ (active_effect); |
| 132 | var previous_reaction = active_reaction; |
| 133 | var previous_component_context = component_context; |
| 134 | var previous_batch = /** @type {Batch} */ (current_batch); |
| 135 | |
| 136 | if (DEV) { |
| 137 | var previous_dev_stack = dev_stack; |
| 138 | } |
| 139 | |
| 140 | return function restore(activate_batch = true) { |
| 141 | set_active_effect(previous_effect); |
| 142 | set_active_reaction(previous_reaction); |
| 143 | set_component_context(previous_component_context); |
| 144 | |
| 145 | if (activate_batch && (previous_effect.f & DESTROYED) === 0) { |
| 146 | // TODO we only need optional chaining here because `{#await ...}` blocks |
| 147 | // are anomalous. Once we retire them we can get rid of it |
| 148 | previous_batch?.activate(); |
| 149 | previous_batch?.apply(); |
| 150 | } |
| 151 | |
| 152 | if (DEV) { |
| 153 | set_reactivity_loss_tracker(null); |
| 154 | set_dev_stack(previous_dev_stack); |
| 155 | } |
| 156 | }; |
| 157 | } |
| 158 | |
| 159 | /** |
| 160 | * Wraps an `await` expression in such a way that the effect context that was |
no test coverage detected
searching dependent graphs…