1
0
Fork 0
mirror of synced 2024-09-29 16:51:33 +13:00

Remove timeoutIds

This commit is contained in:
Mel O'Hagan 2022-07-28 09:39:24 +01:00
parent b0a714de28
commit fc0bffda60

View file

@ -4,17 +4,9 @@ import { routeStore } from "./routes"
const NOTIFICATION_TIMEOUT = 3000
const createNotificationStore = () => {
const timeoutIds = new Set()
let block = false
const store = writable([], () => {
return () => {
timeoutIds.forEach(timeoutId => {
clearTimeout(timeoutId)
})
store.set([])
}
})
const store = writable([])
const blockNotifications = (timeout = 1000) => {
block = true
@ -54,10 +46,9 @@ const createNotificationStore = () => {
]
})
if (autoDismiss) {
const timeoutId = setTimeout(() => {
setTimeout(() => {
dismiss(_id)
}, NOTIFICATION_TIMEOUT)
timeoutIds.add(timeoutId)
}
}