()
| 438 | // a hidden tab becomes visible again, so a dot that arrived while hidden is |
| 439 | // dropped once the user is actually looking. |
| 440 | function clearActiveUnread(): void { |
| 441 | const active = rawState.activeSessionId; |
| 442 | if ( |
| 443 | active && |
| 444 | rawState.unreadBySession[active] && |
| 445 | typeof document !== 'undefined' && |
| 446 | document.visibilityState === 'visible' |
| 447 | ) { |
| 448 | rawState.unreadBySession = { ...rawState.unreadBySession, [active]: false }; |
| 449 | saveUnread({ [active]: false }); |
| 450 | } |
| 451 | } |
| 452 | |
| 453 | if (typeof window !== 'undefined') { |
| 454 | window.addEventListener('storage', (event) => { |
no test coverage detected