We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e8442fd commit 3f75bc9Copy full SHA for 3f75bc9
docs/App.svelte
@@ -85,7 +85,10 @@ toast.pop()
85
86
// Or remove a particular one
87
const id = toast.push('Yo!')
88
-toast.pop(id)`,
+toast.pop(id)
89
+
90
+// Or remove all active toasts
91
+toast.pop(0)`,
92
run: () => {
93
toast.pop()
94
}
src/stores.js
@@ -10,7 +10,11 @@ const createToast = () => {
10
return count
11
12
const pop = id => {
13
- update(n => id ? n.filter(i => i.id !== id) : n.splice(1))
+ update(n => {
14
+ if (n.length === 0 || id === 0) return []
15
+ const target = id || Math.max(...n.map(i => i.id))
16
+ return n.filter(i => i.id !== target)
17
+ })
18
19
const set = (id, obj) => {
20
update(n => {
0 commit comments