keep-vue
Version:
Keep Vue is an open-source component library built on top of Vue3 and Tailwind CSS. It offers a collection of pre-designed UI components and styles that you can easily integrate into your web applications.
16 lines (15 loc) • 582 B
JavaScript
import { createInjectionState } from "@vueuse/core";
import {} from "vue";
const NotificationStoreKey = "notification-store";
const [useProvideNotification, useInjectNotification] = createInjectionState((position) => {
return { position };
}, {
injectionKey: NotificationStoreKey,
});
function useNotification() {
const notificationState = useInjectNotification();
if (!notificationState)
throw new Error("useNotification must be used within a <Notification /> Component");
return notificationState;
}
export { useNotification, useProvideNotification };