From 7bd0f29af3ffadef410663cf64a7a36506786854 Mon Sep 17 00:00:00 2001 From: tlkh40 <72644753+tlkh40@users.noreply.github.com> Date: Wed, 29 Jun 2022 19:57:12 +0700 Subject: [PATCH] fix: apply suggestions --- src/Notification/InlineNotification.svelte | 10 ++++++++-- src/Notification/ToastNotification.svelte | 6 +++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/Notification/InlineNotification.svelte b/src/Notification/InlineNotification.svelte index 19cb0588..4cd57717 100644 --- a/src/Notification/InlineNotification.svelte +++ b/src/Notification/InlineNotification.svelte @@ -40,8 +40,14 @@ let timeoutId = undefined; function close(closeFromTimeout) { - open = false; - dispatch("close", { timeout: closeFromTimeout === true }); + const shouldContinue = dispatch( + "close", + { timeout: closeFromTimeout === true }, + { cancelable: true } + ); + if (shouldContinue) { + open = false; + } } onMount(() => { diff --git a/src/Notification/ToastNotification.svelte b/src/Notification/ToastNotification.svelte index 715bb8e0..1d00ba4e 100644 --- a/src/Notification/ToastNotification.svelte +++ b/src/Notification/ToastNotification.svelte @@ -43,7 +43,11 @@ let timeoutId = undefined; function close(closeFromTimeout) { - const shouldContinue = dispatch("close", { timeout: closeFromTimeout === true }, { cancelable: true }); + const shouldContinue = dispatch( + "close", + { timeout: closeFromTimeout === true }, + { cancelable: true } + ); if (shouldContinue) { open = false; }