beforeRender/afterRender -> beforeUpdate/afterUpdate

pull/1864/head
Rich Harris 7 years ago
parent 0019873dfb
commit 8d3fd4d1f6

@ -101,7 +101,7 @@ export default class Stats {
oncreate: false, oncreate: false,
onDestroy: false, onDestroy: false,
onstate: false, onstate: false,
afterRender: false afterUpdate: false
}; };
return { return {

@ -20,9 +20,9 @@ export function mount_component({ $$: { fragment }}, target, anchor, hydrate) {
component.$$.inject_refs(component.$$.refs); component.$$.inject_refs(component.$$.refs);
// onMount happens after the initial afterRender. Because // onMount happens after the initial afterUpdate. Because
// afterRender callbacks happen in reverse order (inner first) // afterUpdate callbacks happen in reverse order (inner first)
// we schedule onMount callbacks before afterRender callbacks // we schedule onMount callbacks before afterUpdate callbacks
add_render_callback(() => { add_render_callback(() => {
const onDestroy = component.$$.on_mount.map(run).filter(is_function); const onDestroy = component.$$.on_mount.map(run).filter(is_function);
if (component.$$.on_destroy) { if (component.$$.on_destroy) {

@ -4,7 +4,7 @@ export function set_current_component(component) {
current_component = component; current_component = component;
} }
export function beforeRender(fn) { export function beforeUpdate(fn) {
current_component.$$.before_render.push(fn); current_component.$$.before_render.push(fn);
} }
@ -12,7 +12,7 @@ export function onMount(fn) {
current_component.$$.on_mount.push(fn); current_component.$$.on_mount.push(fn);
} }
export function afterRender(fn) { export function afterUpdate(fn) {
current_component.$$.after_render.push(fn); current_component.$$.after_render.push(fn);
} }

@ -28,7 +28,7 @@ export function flush() {
const seen_callbacks = new Set(); const seen_callbacks = new Set();
do { do {
// first, call beforeRender functions // first, call beforeUpdate functions
// and update components // and update components
while (dirty_components.length) { while (dirty_components.length) {
update(dirty_components.shift().$$); update(dirty_components.shift().$$);
@ -37,7 +37,7 @@ export function flush() {
while (binding_callbacks.length) binding_callbacks.pop()(); while (binding_callbacks.length) binding_callbacks.pop()();
// then, once components are updated, call // then, once components are updated, call
// afterRender functions. This may cause // afterUpdate functions. This may cause
// subsequent updates... // subsequent updates...
while (render_callbacks.length) { while (render_callbacks.length) {
const callback = render_callbacks.pop(); const callback = render_callbacks.pop();

Loading…
Cancel
Save