UNPKG

@stories-js/core

Version:

Stories web components to build stories

24 lines 710 B
/*! * (C) StoriesJS https://storiesjs.org - GPL-2.0 License */ /* eslint-disable @typescript-eslint/no-explicit-any */ import { state } from '../store'; export const notificationsAPI = { addNotification(notification) { // Get rid of it if already exists notificationsAPI.clearNotification(notification.id); state.notifications = [...state.notifications, notification]; }, clearNotification(id) { state.notifications = state.notifications.filter((notification) => { if (notification.id === id) { if (notification.onClear) { notification.onClear(); } return false; } return true; }); } }; //# sourceMappingURL=notifications.js.map