(toastId: string)
| 56 | const toastTimeouts = new Map<string, ReturnType<typeof setTimeout>>() |
| 57 | |
| 58 | const addToRemoveQueue = (toastId: string) => { |
| 59 | if (toastTimeouts.has(toastId)) { |
| 60 | return |
| 61 | } |
| 62 | |
| 63 | const timeout = setTimeout(() => { |
| 64 | toastTimeouts.delete(toastId) |
| 65 | dispatch({ |
| 66 | type: "REMOVE_TOAST", |
| 67 | toastId: toastId, |
| 68 | }) |
| 69 | }, TOAST_REMOVE_DELAY) |
| 70 | |
| 71 | toastTimeouts.set(toastId, timeout) |
| 72 | } |
| 73 | |
| 74 | export const reducer = (state: State, action: Action): State => { |
| 75 | switch (action.type) { |