primevue-mirror/components/toastservice/ToastService.js

22 lines
637 B
JavaScript
Raw Normal View History

2022-09-06 12:03:37 +00:00
import ToastEventBus from 'primevue/toasteventbus';
2022-09-14 11:26:01 +00:00
import { PrimeVueToastSymbol } from 'primevue/usetoast';
2022-09-06 12:03:37 +00:00
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');
}
};
2022-09-14 11:26:01 +00:00
2022-09-06 12:03:37 +00:00
app.config.globalProperties.$toast = ToastService;
app.provide(PrimeVueToastSymbol, ToastService);
}
2022-09-14 11:26:01 +00:00
};