|
|
|
|
@ -80,10 +80,9 @@ function push_effect(effect, parent_effect) {
|
|
|
|
|
* @param {number} type
|
|
|
|
|
* @param {null | (() => void | (() => void))} fn
|
|
|
|
|
* @param {boolean} sync
|
|
|
|
|
* @param {boolean} push
|
|
|
|
|
* @returns {Effect}
|
|
|
|
|
*/
|
|
|
|
|
function create_effect(type, fn, sync, push = true) {
|
|
|
|
|
function create_effect(type, fn, sync) {
|
|
|
|
|
var parent = active_effect;
|
|
|
|
|
|
|
|
|
|
if (DEV) {
|
|
|
|
|
@ -133,7 +132,6 @@ function create_effect(type, fn, sync, push = true) {
|
|
|
|
|
schedule_effect(effect);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (push) {
|
|
|
|
|
/** @type {Effect | null} */
|
|
|
|
|
var e = effect;
|
|
|
|
|
|
|
|
|
|
@ -171,9 +169,6 @@ function create_effect(type, fn, sync, push = true) {
|
|
|
|
|
(derived.effects ??= []).push(e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
console.trace('not pushing');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return effect;
|
|
|
|
|
}
|
|
|
|
|
@ -388,13 +383,11 @@ export function block(fn, flags = 0) {
|
|
|
|
|
return effect;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TODO i think we don't need `push` any more?
|
|
|
|
|
/**
|
|
|
|
|
* @param {(() => void)} fn
|
|
|
|
|
* @param {boolean} [push]
|
|
|
|
|
*/
|
|
|
|
|
export function branch(fn, push = true) {
|
|
|
|
|
return create_effect(BRANCH_EFFECT | EFFECT_PRESERVED, fn, true, push);
|
|
|
|
|
export function branch(fn) {
|
|
|
|
|
return create_effect(BRANCH_EFFECT | EFFECT_PRESERVED, fn, true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|