mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-20 12:23:02 +00:00
refactor(switch): replace onDestroy with onMount return function
This commit is contained in:
parent
7e919d121f
commit
4a238ac041
1 changed files with 3 additions and 3 deletions
|
@ -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>
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue