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

25 lines
742 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);
},
remove: (message) => {
ToastEventBus.emit('remove', message);
},
removeGroup: (group) => {
ToastEventBus.emit('remove-group', group);
},
removeAllGroups: () => {
ToastEventBus.emit('remove-all-groups');
}
};
app.config.globalProperties.$toast = ToastService;
app.provide(PrimeVueToastSymbol, ToastService);
}
};