UNPKG

alpinejs-notify

Version:

Simple notifications in your projects using Alpine JS 🙋‍♀️

25 lines (20 loc) 771 B
import { handleAutoClose } from './handleAutoClose' import { handleAutoRemove } from './handleAutoRemove' import { handleClassNames } from './handleClassNames' import { createNotification } from './createNotification' export function useTemplate(notificationText, notificationData) { const notificationComponent = createNotification( notificationData.wrapperId, notificationData.templateId, notificationText ) if (notificationData.autoClose) { handleAutoClose(notificationComponent, notificationData.autoClose) } if (notificationData.autoRemove) { handleAutoRemove(notificationComponent, notificationData.autoRemove) } if (notificationData.classNames) { handleClassNames(notificationData.classNames, notificationComponent) } }