ToastNotification has a built-in timeout mechanism, which automatically closes the toast and fires the close event.
However, if the toast is dismissed manually in that timeframe, the timeout is not stopped and there will be two close events. First the one from the click, then the one from the timeout.
Example:
const t = new ToastNotification({
target: document.body,
props: { timeout: 2000, title: 'Close this before timeout' },
});
t.$on('close', e => { console.log(e.detail); });
ToastNotification
has a built-in timeout mechanism, which automatically closes the toast and fires the close event.However, if the toast is dismissed manually in that timeframe, the timeout is not stopped and there will be two close events. First the one from the click, then the one from the timeout.
Example:
REPL
The timeout should probably be cleared as soon as the toast is closed. Also, it analogously should be started on open, not just
onMount
.