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