jv3-alert
Version:
easy alert from assign by route by cdnagroup
19 lines (18 loc) • 629 B
JavaScript
import { inject } from "vue";
import JAlert from "@/jalert";
const defaultConfig = {};
async function JV3Alert(app, localOptions = {}) {
const jalert = new JAlert({ ...defaultConfig, ...localOptions });
app.config.globalProperties.$jalert = jalert;
app.provide("jalert", jalert);
}
export function useJAlert() {
const jalert = inject("jalert");
if (!jalert) {
throw new Error("JV3Alert not provided. Make sure to call JV3Alert(app) in your main.js or main.ts.");
}
return jalert;
}
const JV3AlertInstant = new JAlert({});
export { JV3Alert, JAlert, JV3AlertInstant };
export default JV3Alert;