only allow passing functions to lifecycle functions (#5529)

pull/7738/head
Andreas Ehrencrona 5 years ago committed by GitHub
parent 607e52b351
commit 2917a8e3d0

@ -11,19 +11,19 @@ export function get_current_component() {
return current_component; return current_component;
} }
export function beforeUpdate(fn) { export function beforeUpdate(fn: () => any) {
get_current_component().$$.before_update.push(fn); get_current_component().$$.before_update.push(fn);
} }
export function onMount(fn) { export function onMount(fn: () => any) {
get_current_component().$$.on_mount.push(fn); get_current_component().$$.on_mount.push(fn);
} }
export function afterUpdate(fn) { export function afterUpdate(fn: () => any) {
get_current_component().$$.after_update.push(fn); get_current_component().$$.after_update.push(fn);
} }
export function onDestroy(fn) { export function onDestroy(fn: () => any) {
get_current_component().$$.on_destroy.push(fn); get_current_component().$$.on_destroy.push(fn);
} }

Loading…
Cancel
Save