MCPcopy Create free account
hub / github.com/Seanium/ChatMap / useToast

Function useToast

components/ui/use-toast.ts:157–175  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

155}
156
157function useToast() {
158 const [state, setState] = useState<State>(memoryState)
159
160 useEffect(() => {
161 listeners.push(setState)
162 return () => {
163 const index = listeners.indexOf(setState)
164 if (index > -1) {
165 listeners.splice(index, 1)
166 }
167 }
168 }, [state])
169
170 return {
171 ...state,
172 toast,
173 dismiss: (toastId?: string) => dispatch({ type: "DISMISS_TOAST", toastId }),
174 }
175}
176
177export { useToast, toast }

Callers 3

ChatInterfaceFunction · 0.90
ModelSettingsFunction · 0.90
ToasterFunction · 0.90

Calls 1

dispatchFunction · 0.70

Tested by

no test coverage detected