UNPKG

@qvant/qui-max

Version:

A Vue 3 Design system for Web.

21 lines (20 loc) 806 B
import { provide, getCurrentInstance, inject } from "vue"; import { createNotification } from "./src/index.js"; import { Q_NOTIFY_INJECTION_KEY } from "./src/constants.js"; export { NotifyType, Q_NOTIFY_INJECTION_KEY } from "./src/constants.js"; const QNotification = { install: (app, options) => { const notify = createNotification(options); app.provide(Q_NOTIFY_INJECTION_KEY, notify); } }; const provideNotify = (options) => { const notify = createNotification(options); provide(Q_NOTIFY_INJECTION_KEY, notify); }; const useNotify = (options) => { const notify = getCurrentInstance() ? inject(Q_NOTIFY_INJECTION_KEY) : null; return notify != null ? notify : createNotification(options, false); }; export { QNotification, provideNotify, useNotify }; //# sourceMappingURL=index.js.map