mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-16 17:46:18 +08:00
feat: modify toast interface
This commit is contained in:
@@ -42,13 +42,17 @@ const createToastContainer = () => {
|
||||
return element;
|
||||
};
|
||||
|
||||
export type ToastOptions = {
|
||||
duration: number;
|
||||
};
|
||||
|
||||
/**
|
||||
* @example
|
||||
* ```ts
|
||||
* toast('Hello World');
|
||||
* ```
|
||||
*/
|
||||
export const toast = (message: string, duration = 2500) => {
|
||||
export const toast = (message: string, { duration = 2500 }: ToastOptions) => {
|
||||
if (!ToastContainer) {
|
||||
ToastContainer = createToastContainer();
|
||||
}
|
||||
@@ -101,4 +105,5 @@ export const toast = (message: string, duration = 2500) => {
|
||||
return element;
|
||||
};
|
||||
|
||||
|
||||
export default toast;
|
||||
|
||||
Reference in New Issue
Block a user