@datalayer/core
Version:
**Datalayer Core**
43 lines (42 loc) • 1.24 kB
TypeScript
import { type Id } from 'react-toastify';
import { Notification } from '@jupyterlab/apputils';
export type ToastProps = {
/**
* List of associated actions
*/
actions?: Notification.IAction[];
/**
* Autoclosing behavior - false (not closing automatically) or number (time in milliseconds before hiding the notification)
*/
autoClose?: number | false;
/**
* Notification type
*/
variant: 'info' | 'success' | 'warning' | 'error';
};
export declare const useToast: () => Readonly<{
/**
* Emit a message as a toast.
*
* @param message Toast message
* @param options Toast option
* @returns Toast id
*/
enqueueToast: (message: string, options?: ToastProps) => Id;
/**
* Dismiss a toast
*
* @param id Toast id
*/
dismiss: (id?: Id) => void;
/**
* Track the progress of an asynchronous task
* and display a message depending on the outcome.
*
* @param promise Asynchronous task
* @param options Task progress options
* @returns Toast id
*/
trackAsyncTask: (promise: Promise<any>, options: Notification.IPromiseOptions<any>) => string | Promise<any>;
}>;
export default useToast;