Skip to content

Commit

Permalink
Immediate effect max notifications (#41)
Browse files Browse the repository at this point in the history
Co-authored-by: Hargitai Tamas <[email protected]>
  • Loading branch information
Tamas-hi and Hargitai Tamas authored Jul 4, 2023
1 parent 10e4a52 commit 41cf8d9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Notification.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,10 @@ const notificationsByGroup = computed(() =>
);
const sortedNotifications = computed(() => {
if (context.position === "bottom") {
return [...notificationsByGroup.value].slice(0, props.maxNotifications);
return [...notificationsByGroup.value];
}
return [...notificationsByGroup.value]
.reverse()
.slice(0, props.maxNotifications);
return [...notificationsByGroup.value].reverse();
});
const setupTimeout = (notificationId: number, timeout?: number) => {
Expand Down Expand Up @@ -80,6 +78,8 @@ const add = ({
notification: Notification;
timeout?: number;
}) => {
if(state.notifications.length === props.maxNotifications) return;
state.notifications.push(notification);
setupTimeout(notification.id, timeout)
};
Expand Down

0 comments on commit 41cf8d9

Please sign in to comment.