diff --git a/src/lib/layout/notification.svelte b/src/lib/layout/notification.svelte index 01ee630e9..ca5b33c4b 100644 --- a/src/lib/layout/notification.svelte +++ b/src/lib/layout/notification.svelte @@ -4,6 +4,7 @@ export let type: Notification['type'] = 'info'; export let title: Notification['title']; + export let func: Notification['func']; let icon: string; switch (type) { @@ -43,14 +44,13 @@ {/if}

- + {#if func} +
+ {#each func as f} + + {/each} +
+ {/if} diff --git a/src/lib/layout/notifications.svelte b/src/lib/layout/notifications.svelte index 547ae8def..dde7dcdda 100644 --- a/src/lib/layout/notifications.svelte +++ b/src/lib/layout/notifications.svelte @@ -10,7 +10,8 @@ dismissNotification(notification.id)}> + on:dismiss={() => dismissNotification(notification.id)} + func={notification?.func}> {notification.message} {/each} diff --git a/src/lib/stores/notifications.ts b/src/lib/stores/notifications.ts index 5a9fffe9d..ce67f7899 100644 --- a/src/lib/stores/notifications.ts +++ b/src/lib/stores/notifications.ts @@ -7,6 +7,12 @@ export type Notification = { timeout?: number; message: string; title?: string; + func?: Func[]; +}; + +export type Func = { + method: () => void; //TODO Check if promise is needed rather tha () => void + name: string; }; let counter = 0;