()
| 10 | } |
| 11 | |
| 12 | function readClicks(): SquadBoostClick[] { |
| 13 | try { |
| 14 | const stored = window.sessionStorage.getItem(STORAGE_KEY); |
| 15 | const clicks = stored ? (JSON.parse(stored) as SquadBoostClick[]) : []; |
| 16 | const now = Date.now(); |
| 17 | |
| 18 | return clicks.filter( |
| 19 | (click) => now - click.timestamp < SQUAD_BOOST_CLICK_TTL_MS, |
| 20 | ); |
| 21 | } catch { |
| 22 | return []; |
| 23 | } |
| 24 | } |
| 25 | |
| 26 | function writeClicks(clicks: SquadBoostClick[]): void { |
| 27 | try { |
no test coverage detected