mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 10:21:05 +00:00
Refactor onDestroy
to use onMount
return function (#914)
* refactor(select-item): replace onDestroy with onMount return function * refactor(date-picker): replace onDestroy with onMount return function * refactor(switch): replace onDestroy with onMount return function * refactor(composed-modal): replace onDestroy with onMount return function
This commit is contained in:
parent
a160ef3b40
commit
dfd53ce09b
4 changed files with 23 additions and 21 deletions
|
@ -36,7 +36,6 @@
|
|||
setContext,
|
||||
onMount,
|
||||
afterUpdate,
|
||||
onDestroy,
|
||||
} from "svelte";
|
||||
import { writable } from "svelte/store";
|
||||
|
||||
|
@ -73,13 +72,14 @@
|
|||
let opened = false;
|
||||
$: didOpen = open;
|
||||
|
||||
onMount(async () => {
|
||||
await tick();
|
||||
focus();
|
||||
});
|
||||
onMount(() => {
|
||||
tick().then(() => {
|
||||
focus();
|
||||
});
|
||||
|
||||
onDestroy(() => {
|
||||
document.body.classList.remove("bx--body--with-modal-open");
|
||||
return () => {
|
||||
document.body.classList.remove("bx--body--with-modal-open");
|
||||
};
|
||||
});
|
||||
|
||||
afterUpdate(() => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue