mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-18 11:36: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 open = true;
|
||||||
let timeoutId = undefined;
|
let timeoutId = undefined;
|
||||||
|
|
||||||
function close() {
|
function close(closeFromTimeout) {
|
||||||
open = false;
|
open = false;
|
||||||
dispatch("close");
|
dispatch("close", { timeout: closeFromTimeout === true });
|
||||||
}
|
}
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
if (timeout) {
|
if (timeout) {
|
||||||
timeoutId = setTimeout(() => close(), timeout);
|
timeoutId = setTimeout(() => close(true), timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
|
|
|
@ -45,14 +45,14 @@
|
||||||
let open = true;
|
let open = true;
|
||||||
let timeoutId = undefined;
|
let timeoutId = undefined;
|
||||||
|
|
||||||
function close() {
|
function close(closeFromTimeout) {
|
||||||
open = false;
|
open = false;
|
||||||
dispatch("close");
|
dispatch("close", { timeout: closeFromTimeout === true });
|
||||||
}
|
}
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
if (timeout) {
|
if (timeout) {
|
||||||
timeoutId = setTimeout(() => close(), timeout);
|
timeoutId = setTimeout(() => close(true), timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue