(key: string, compute: () => T)
| 1460 | } |
| 1461 | |
| 1462 | private withCache<T>(key: string, compute: () => T): T { |
| 1463 | const cached = this.navigationCache.get(key) |
| 1464 | if (cached !== undefined) return cached as T |
| 1465 | |
| 1466 | const result = compute() |
| 1467 | this.navigationCache.set(key, result as number) |
| 1468 | return result |
| 1469 | } |
| 1470 | |
| 1471 | nextOffset(offset: number): number { |
| 1472 | return this.withCache(`next:${offset}`, () => { |
no test coverage detected