UNPKG

use-stomp

Version:

react provider, class decorator, and a hook for websockets using the stomp protocol

20 lines (19 loc) 876 B
import type { OptionsObject, VariantType } from 'notistack'; import * as React from 'react'; export declare type UseStompNotificationsProps<T, M> = [ T[], (otherChannelOrMessage: string | T, message?: M) => void, boolean ]; export declare type StompNotification<T> = { id: string; content: T; dismiss: () => void; variant?: VariantType; }; export declare type StompNotistackOptions<T> = Omit<OptionsObject, 'action' | 'key'> & { action: (dismiss: () => void) => React.ReactNode; parseMessage?: (message: StompNotification<T>) => React.ReactNode; parseVariant?: (message: StompNotification<T>) => VariantType; }; export default function useStompNotifications<ReceiveMessage, SendMessage = any>(channel: string, options?: StompNotistackOptions<ReceiveMessage>): UseStompNotificationsProps<StompNotification<ReceiveMessage>, SendMessage>;