rename async_effect/fragment to offscreen_effect/fragment — much clearer IMHO

aa
Rich Harris 7 months ago
parent 36e281c8c9
commit adb137579f

@ -73,10 +73,10 @@ export function boundary(node, props, children) {
var boundary_effect; var boundary_effect;
/** @type {Effect | null} */ /** @type {Effect | null} */
var async_effect = null; var offscreen_effect = null;
/** @type {DocumentFragment | null} */ /** @type {DocumentFragment | null} */
var async_fragment = null; var offscreen_fragment = null;
var async_count = 0; var async_count = 0;
var boundary = /** @type {Effect} */ (active_effect); var boundary = /** @type {Effect} */ (active_effect);
@ -104,20 +104,20 @@ export function boundary(node, props, children) {
} }
function suspend() { function suspend() {
if (async_effect || !boundary_effect) { if (offscreen_effect || !boundary_effect) {
return; return;
} }
var effect = boundary_effect; var effect = boundary_effect;
async_effect = boundary_effect; offscreen_effect = boundary_effect;
pause_effect( pause_effect(
async_effect, boundary_effect,
() => { () => {
/** @type {TemplateNode | null} */ /** @type {TemplateNode | null} */
var node = effect.nodes_start; var node = effect.nodes_start;
var end = effect.nodes_end; var end = effect.nodes_end;
async_fragment = document.createDocumentFragment(); offscreen_fragment = document.createDocumentFragment();
while (node !== null) { while (node !== null) {
/** @type {TemplateNode | null} */ /** @type {TemplateNode | null} */
@ -125,7 +125,7 @@ export function boundary(node, props, children) {
node === end ? null : /** @type {TemplateNode} */ (get_next_sibling(node)); node === end ? null : /** @type {TemplateNode} */ (get_next_sibling(node));
node.remove(); node.remove();
async_fragment.append(node); offscreen_fragment.append(node);
node = sibling; node = sibling;
} }
}, },
@ -142,7 +142,7 @@ export function boundary(node, props, children) {
} }
function unsuspend() { function unsuspend() {
if (!async_effect) { if (!offscreen_effect) {
return; return;
} }
@ -150,9 +150,9 @@ export function boundary(node, props, children) {
destroy_effect(boundary_effect); destroy_effect(boundary_effect);
} }
boundary_effect = async_effect; boundary_effect = offscreen_effect;
async_effect = null; offscreen_effect = null;
anchor.before(/** @type {DocumentFragment} */ (async_fragment)); anchor.before(/** @type {DocumentFragment} */ (offscreen_fragment));
resume_effect(boundary_effect); resume_effect(boundary_effect);
} }

Loading…
Cancel
Save