|
|
|
@ -39,9 +39,10 @@ import { remove } from '../dom/reconciler.js';
|
|
|
|
* @returns {import('#client').Effect}
|
|
|
|
* @returns {import('#client').Effect}
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
function create_effect(type, fn, sync, init = true) {
|
|
|
|
function create_effect(type, fn, sync, init = true) {
|
|
|
|
|
|
|
|
var is_root = (type & ROOT_EFFECT) !== 0;
|
|
|
|
/** @type {import('#client').Effect} */
|
|
|
|
/** @type {import('#client').Effect} */
|
|
|
|
const effect = {
|
|
|
|
var effect = {
|
|
|
|
parent: current_effect,
|
|
|
|
parent: is_root ? null : current_effect,
|
|
|
|
dom: null,
|
|
|
|
dom: null,
|
|
|
|
deps: null,
|
|
|
|
deps: null,
|
|
|
|
f: type | DIRTY,
|
|
|
|
f: type | DIRTY,
|
|
|
|
@ -58,7 +59,7 @@ function create_effect(type, fn, sync, init = true) {
|
|
|
|
effect.l = current_effect.l + 1;
|
|
|
|
effect.l = current_effect.l + 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (current_reaction !== null) {
|
|
|
|
if (current_reaction !== null && !is_root) {
|
|
|
|
if (current_reaction.effects === null) {
|
|
|
|
if (current_reaction.effects === null) {
|
|
|
|
current_reaction.effects = [effect];
|
|
|
|
current_reaction.effects = [effect];
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
@ -68,7 +69,7 @@ function create_effect(type, fn, sync, init = true) {
|
|
|
|
|
|
|
|
|
|
|
|
if (init) {
|
|
|
|
if (init) {
|
|
|
|
if (sync) {
|
|
|
|
if (sync) {
|
|
|
|
const previously_flushing_effect = is_flushing_effect;
|
|
|
|
var previously_flushing_effect = is_flushing_effect;
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
set_is_flushing_effect(true);
|
|
|
|
set_is_flushing_effect(true);
|
|
|
|
|