import { createEventBus } from "@grozav/utils";
import { InklineToastKey } from "@inkline/inkline";
export const toastEventBus = createEventBus();
export const createToastService = () => ({
  show: (options) => {
    toastEventBus.emit("show", options);
  },
  hide: (options) => {
    toastEventBus.emit("hide", options);
  },
  hideAll: () => {
    toastEventBus.emit("hideAll", {});
  }
});
export const ToastPlugin = {
  install: (app) => {
    const toastService = createToastService();
    app.config.globalProperties.$toast = toastService;
    app.provide(InklineToastKey, toastService);
  }
};
