MCPcopy
hub / github.com/chronark/highstorm / useToast

Function useToast

apps/web/hooks/use-toast.ts:168–186  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

166}
167
168function useToast() {
169 const [state, setState] = React.useState<State>(memoryState);
170
171 React.useEffect(() => {
172 listeners.push(setState);
173 return () => {
174 const index = listeners.indexOf(setState);
175 if (index > -1) {
176 listeners.splice(index, 1);
177 }
178 };
179 }, [state]);
180
181 return {
182 ...state,
183 toast,
184 dismiss: (toastId?: string) => dispatch({ type: "DISMISS_TOAST", toastId }),
185 };
186}
187
188export { useToast, toast };

Callers 13

ToasterFunction · 0.90
OnboardingFunction · 0.90
CreateChannelButtonFunction · 0.90
AnalyticsFunction · 0.90
DeleteChannelButtonFunction · 0.90
DeleteReportButtonFunction · 0.90
DeleteWebhookButtonFunction · 0.90
StreamsPageFunction · 0.90
DeleteKeyButtonFunction · 0.90
CreateKeyButtonFunction · 0.90

Calls 1

dispatchFunction · 0.85

Tested by

no test coverage detected