diff options
Diffstat (limited to 'src/lib/Notification/store.ts')
| -rw-r--r-- | src/lib/Notification/store.ts | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/src/lib/Notification/store.ts b/src/lib/Notification/store.ts index 0cb4cf96..4eb163f9 100644 --- a/src/lib/Notification/store.ts +++ b/src/lib/Notification/store.ts @@ -1,32 +1,32 @@ -import { writable } from 'svelte/store'; +import { writable } from "svelte/store"; export interface Notification { - id: string; - heading: string; - description?: string; - duration?: number; + id: string; + heading: string; + description?: string; + duration?: number; } function createNotificationStore() { - const { subscribe, update } = writable<Notification[]>([]); + const { subscribe, update } = writable<Notification[]>([]); - return { - subscribe, - add: (notification: Omit<Notification, 'id'>) => { - const id = crypto.randomUUID(); + return { + subscribe, + add: (notification: Omit<Notification, "id">) => { + const id = crypto.randomUUID(); - update((notifications) => [...notifications, { ...notification, id }]); + update((notifications) => [...notifications, { ...notification, id }]); - return id; - }, - remove: (id: string) => { - update((notifications) => notifications.filter((n) => n.id !== id)); - } - }; + return id; + }, + remove: (id: string) => { + update((notifications) => notifications.filter((n) => n.id !== id)); + }, + }; } export const notifications = createNotificationStore(); -export function addNotification(notification: Omit<Notification, 'id'>) { - return notifications.add(notification); +export function addNotification(notification: Omit<Notification, "id">) { + return notifications.add(notification); } |