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