primevue-mirror/packages/primevue/src/toastservice/ToastService.js

25 lines
742 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);
},
remove: (message) => {
ToastEventBus.emit('remove', message);
},
2022-09-06 12:03:37 +00:00
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
};