only allow passing functions to lifecycle functions (#5529)

pull/5564/head
Andreas Ehrencrona 4 years ago committed by GitHub
parent 0ec928324f
commit 46690473ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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