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