Skip to content

Commit

Permalink
Drop old announcements if the queue exceeds three, preferering most r…
Browse files Browse the repository at this point in the history
…ecent.
  • Loading branch information
amyjko committed Aug 25, 2024
1 parent bc20251 commit 16db5fe
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Dates are in `YYYY-MM-DD` format and versions are in [semantic versioning](http:

- Included past tense verbs in higher order functions.
- Fixed aria-label updates.
- Drop old announcements if the queue exceeds three, preferering most recent.

## 0.10.10 2024-08-12

Expand Down
6 changes: 6 additions & 0 deletions src/components/project/Announcer.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@
// Is there a timeout? Wait for it to dequue.
if (timeout) return;
// Have we fallen behind? Trim everything by the most recent.
if (announcements.length > 3) {
const mostRecent = announcements.shift();
if (mostRecent) announcements = [mostRecent];
}
// Grab the message of a different kind from the current message, or the next one if there aren't any.
let next = announcements.pop();
announcements = [];
Expand Down

0 comments on commit 16db5fe

Please sign in to comment.