refactor(switch): replace onDestroy with onMount return function

This commit is contained in:
metonym 2021-11-17 13:15:30 -08:00
commit 4a238ac041

View file

@ -17,7 +17,7 @@
/** Obtain a reference to the button HTML element */
export let ref = null;
import { afterUpdate, getContext, onDestroy } from "svelte";
import { afterUpdate, getContext, onMount } from "svelte";
const ctx = getContext("ContentSwitcher");
@ -33,8 +33,8 @@
}
});
onDestroy(() => {
unsubscribe();
onMount(() => {
return () => unsubscribe();
});
</script>