primevue-mirror/components/toastservice/ToastService.js

20 lines
632 B
JavaScript
Executable File

import ToastEventBus from 'primevue/toasteventbus';
import {PrimeVueToastSymbol} from 'primevue/usetoast';
export default {
install: (app) => {
const ToastService = {
add: (message) => {
ToastEventBus.emit('add', message);
},
removeGroup: (group) => {
ToastEventBus.emit('remove-group', group);
},
removeAllGroups: () => {
ToastEventBus.emit('remove-all-groups');
}
};
app.config.globalProperties.$toast = ToastService;
app.provide(PrimeVueToastSymbol, ToastService);
}
}