MCPcopy
hub / github.com/Nutlope/self.so / addToRemoveQueue

Function addToRemoveQueue

components/ui/use-toast.ts:58–72  ·  view source on GitHub ↗
(toastId: string)

Source from the content-addressed store, hash-verified

56const toastTimeouts = new Map<string, ReturnType<typeof setTimeout>>();
57
58const 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
74export const reducer = (state: State, action: Action): State => {
75 switch (action.type) {

Callers 1

reducerFunction · 0.70

Calls 1

dispatchFunction · 0.70

Tested by

no test coverage detected