rename effect.v to effect.teardown

pull/10760/head
Rich Harris 2 years ago
parent f14c21e833
commit 313d34223b

@ -36,7 +36,7 @@ function create_effect(type, fn, sync, block, schedule) {
fn,
effects: null,
deriveds: null,
v: null,
teardown: null,
w: 0,
ctx: current_component_context,
y: null
@ -244,7 +244,7 @@ export function render_effect(fn, block = current_block, managed = false, sync =
* @returns {void}
*/
export function destroy_effect(signal) {
const teardown = /** @type {null | (() => void)} */ (signal.v);
const teardown = signal.teardown;
const destroy = signal.y;
destroy_references(signal);
remove_reactions(signal, 0);

@ -44,7 +44,7 @@ export interface Effect extends Reaction {
/** init: The function that we invoke for effects and computeds */
fn: null | (() => void | (() => void)) | ((b: Block, s: Signal) => void | (() => void));
/** value: The latest value for this signal, doubles as the teardown for effects */
v: null | Function;
teardown: null | (() => void);
/** level: the depth from the root signal, used for ordering render/pre-effects topologically **/
l: number;
/** write version: used for unowned signals to track if their depdendencies are dirty or not **/

@ -410,7 +410,7 @@ export function execute_effect(signal) {
if ((signal.f & DESTROYED) !== 0) {
return;
}
const teardown = signal.v;
const teardown = signal.teardown;
const previous_effect = current_effect;
const previous_component_context = current_component_context;
const previous_block = current_block;
@ -428,7 +428,7 @@ export function execute_effect(signal) {
}
const possible_teardown = execute_reaction_fn(signal);
if (typeof possible_teardown === 'function') {
signal.v = possible_teardown;
signal.teardown = possible_teardown;
}
} catch (error) {
const block = signal.block;

Loading…
Cancel
Save