mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-18 03:26:36 +00:00
feat(notification): distinguish dispatched close event between click/timeout
This commit is contained in:
parent
d8c024360a
commit
18f638e994
2 changed files with 6 additions and 6 deletions
|
@ -42,14 +42,14 @@
|
|||
let open = true;
|
||||
let timeoutId = undefined;
|
||||
|
||||
function close() {
|
||||
function close(closeFromTimeout) {
|
||||
open = false;
|
||||
dispatch("close");
|
||||
dispatch("close", { timeout: closeFromTimeout === true });
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
if (timeout) {
|
||||
timeoutId = setTimeout(() => close(), timeout);
|
||||
timeoutId = setTimeout(() => close(true), timeout);
|
||||
}
|
||||
|
||||
return () => {
|
||||
|
|
|
@ -45,14 +45,14 @@
|
|||
let open = true;
|
||||
let timeoutId = undefined;
|
||||
|
||||
function close() {
|
||||
function close(closeFromTimeout) {
|
||||
open = false;
|
||||
dispatch("close");
|
||||
dispatch("close", { timeout: closeFromTimeout === true });
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
if (timeout) {
|
||||
timeoutId = setTimeout(() => close(), timeout);
|
||||
timeoutId = setTimeout(() => close(true), timeout);
|
||||
}
|
||||
|
||||
return () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue