21
common/resources/client/ui/toast/toast.ts
Executable file
21
common/resources/client/ui/toast/toast.ts
Executable file
@@ -0,0 +1,21 @@
|
||||
import {MessageDescriptor} from '../../i18n/message-descriptor';
|
||||
import {ToastOptions, toastState} from './toast-store';
|
||||
|
||||
export function toast(
|
||||
message: MessageDescriptor | string,
|
||||
opts?: ToastOptions
|
||||
) {
|
||||
toastState().add(message, opts);
|
||||
}
|
||||
|
||||
toast.danger = (message: MessageDescriptor | string, opts?: ToastOptions) => {
|
||||
toastState().add(message, {...opts, type: 'danger'});
|
||||
};
|
||||
|
||||
toast.positive = (message: MessageDescriptor | string, opts?: ToastOptions) => {
|
||||
toastState().add(message, {...opts, type: 'positive'});
|
||||
};
|
||||
|
||||
toast.loading = (message: MessageDescriptor | string, opts?: ToastOptions) => {
|
||||
toastState().add(message, {...opts, type: 'loading'});
|
||||
};
|
||||
Reference in New Issue
Block a user