diff --git a/src/Stats.ts b/src/Stats.ts index a1c9d3571b..5efb41b41a 100644 --- a/src/Stats.ts +++ b/src/Stats.ts @@ -101,7 +101,7 @@ export default class Stats { oncreate: false, onDestroy: false, onstate: false, - afterRender: false + afterUpdate: false }; return { diff --git a/src/internal/Component.js b/src/internal/Component.js index cfab792a51..5e51f78c46 100644 --- a/src/internal/Component.js +++ b/src/internal/Component.js @@ -20,9 +20,9 @@ export function mount_component({ $$: { fragment }}, target, anchor, hydrate) { component.$$.inject_refs(component.$$.refs); - // onMount happens after the initial afterRender. Because - // afterRender callbacks happen in reverse order (inner first) - // we schedule onMount callbacks before afterRender callbacks + // onMount happens after the initial afterUpdate. Because + // afterUpdate callbacks happen in reverse order (inner first) + // we schedule onMount callbacks before afterUpdate callbacks add_render_callback(() => { const onDestroy = component.$$.on_mount.map(run).filter(is_function); if (component.$$.on_destroy) { diff --git a/src/internal/lifecycle.js b/src/internal/lifecycle.js index ac8be2ed6c..e413f4c8f4 100644 --- a/src/internal/lifecycle.js +++ b/src/internal/lifecycle.js @@ -4,7 +4,7 @@ export function set_current_component(component) { current_component = component; } -export function beforeRender(fn) { +export function beforeUpdate(fn) { current_component.$$.before_render.push(fn); } @@ -12,7 +12,7 @@ export function onMount(fn) { current_component.$$.on_mount.push(fn); } -export function afterRender(fn) { +export function afterUpdate(fn) { current_component.$$.after_render.push(fn); } diff --git a/src/internal/scheduler.js b/src/internal/scheduler.js index 109ca9cb55..bb688c0222 100644 --- a/src/internal/scheduler.js +++ b/src/internal/scheduler.js @@ -28,7 +28,7 @@ export function flush() { const seen_callbacks = new Set(); do { - // first, call beforeRender functions + // first, call beforeUpdate functions // and update components while (dirty_components.length) { update(dirty_components.shift().$$); @@ -37,7 +37,7 @@ export function flush() { while (binding_callbacks.length) binding_callbacks.pop()(); // then, once components are updated, call - // afterRender functions. This may cause + // afterUpdate functions. This may cause // subsequent updates... while (render_callbacks.length) { const callback = render_callbacks.pop();