Skip to content

Commit

Permalink
add ability to chain toasts
Browse files Browse the repository at this point in the history
  • Loading branch information
blurymind committed Sep 6, 2024
1 parent c7c3c61 commit 6d8907d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/public/web-components.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,10 @@ class Toast extends HTMLElement {
customElements.define('toast-component', Toast);
window.ToastWc = {
show: ({ content, type, time, onClick }) => {
document.querySelector('toast-component').openToast({ content, type, time, onClick })
return new Promise(resolve => {
document.querySelector('toast-component').openToast({ content, type, time, onClick });
setTimeout(()=> resolve(), time + 100)
})
}
}

Expand Down

0 comments on commit 6d8907d

Please sign in to comment.