pause_effects() — svelte Function Reference
Architecture documentation for the pause_effects() function in each.js from the svelte codebase.
Entity Profile
Dependency Diagram
graph TD d31878b6_f94f_35ad_3c78_f4ad9319ffba["pause_effects()"] ca0d28d0_c4b0_db5c_32c9_bdad64d5deaa["each.js"] d31878b6_f94f_35ad_3c78_f4ad9319ffba -->|defined in| ca0d28d0_c4b0_db5c_32c9_bdad64d5deaa 3ceb9b1c_7062_d75e_744a_fd12a80dfdc9["reconcile()"] 3ceb9b1c_7062_d75e_744a_fd12a80dfdc9 -->|calls| d31878b6_f94f_35ad_3c78_f4ad9319ffba 27507f0c_dcab_c3a5_2ce6_5e4b1ef9df3d["pause_effect()"] d31878b6_f94f_35ad_3c78_f4ad9319ffba -->|calls| 27507f0c_dcab_c3a5_2ce6_5e4b1ef9df3d 24ab94ca_01c9_1947_75b2_801fb5cac289["destroy_effects()"] d31878b6_f94f_35ad_3c78_f4ad9319ffba -->|calls| 24ab94ca_01c9_1947_75b2_801fb5cac289 1bd7dd6f_4c22_6f44_9747_fc5ea0deaa7b["block()"] d31878b6_f94f_35ad_3c78_f4ad9319ffba -->|calls| 1bd7dd6f_4c22_6f44_9747_fc5ea0deaa7b 7bff6ec5_15bb_4289_1bd5_99cb794400ed["clear_text_content()"] d31878b6_f94f_35ad_3c78_f4ad9319ffba -->|calls| 7bff6ec5_15bb_4289_1bd5_99cb794400ed a199a3f7_5497_5329_2c7c_fc4555548da6["clear()"] d31878b6_f94f_35ad_3c78_f4ad9319ffba -->|calls| a199a3f7_5497_5329_2c7c_fc4555548da6 style d31878b6_f94f_35ad_3c78_f4ad9319ffba fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/svelte/src/internal/client/dom/blocks/each.js lines 64–126
function pause_effects(state, to_destroy, controlled_anchor) {
/** @type {TransitionManager[]} */
var transitions = [];
var length = to_destroy.length;
/** @type {EachOutroGroup} */
var group;
var remaining = to_destroy.length;
for (var i = 0; i < length; i++) {
let effect = to_destroy[i];
pause_effect(
effect,
() => {
if (group) {
group.pending.delete(effect);
group.done.add(effect);
if (group.pending.size === 0) {
var groups = /** @type {Set<EachOutroGroup>} */ (state.outrogroups);
destroy_effects(array_from(group.done));
groups.delete(group);
if (groups.size === 0) {
state.outrogroups = null;
}
}
} else {
remaining -= 1;
}
},
false
);
}
if (remaining === 0) {
// If we're in a controlled each block (i.e. the block is the only child of an
// element), and we are removing all items, _and_ there are no out transitions,
// we can use the fast path — emptying the element and replacing the anchor
var fast_path = transitions.length === 0 && controlled_anchor !== null;
if (fast_path) {
var anchor = /** @type {Element} */ (controlled_anchor);
var parent_node = /** @type {Element} */ (anchor.parentNode);
clear_text_content(parent_node);
parent_node.append(anchor);
state.items.clear();
}
destroy_effects(to_destroy, !fast_path);
} else {
group = {
pending: new Set(to_destroy),
done: new Set()
};
(state.outrogroups ??= new Set()).add(group);
}
}
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does pause_effects() do?
pause_effects() is a function in the svelte codebase, defined in packages/svelte/src/internal/client/dom/blocks/each.js.
Where is pause_effects() defined?
pause_effects() is defined in packages/svelte/src/internal/client/dom/blocks/each.js at line 64.
What does pause_effects() call?
pause_effects() calls 5 function(s): block, clear, clear_text_content, destroy_effects, pause_effect.
What calls pause_effects()?
pause_effects() is called by 1 function(s): reconcile.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free