(key: string, compute: () => T)
| 1485 | } |
| 1486 | |
| 1487 | private withCache<T>(key: string, compute: () => T): T { |
| 1488 | const cached = this.navigationCache.get(key) |
| 1489 | if (cached !== undefined) return cached as T |
| 1490 | |
| 1491 | const result = compute() |
| 1492 | this.navigationCache.set(key, result as number) |
| 1493 | return result |
| 1494 | } |
| 1495 | |
| 1496 | nextOffset(offset: number): number { |
| 1497 | return this.withCache(`next:${offset}`, () => { |
no test coverage detected