()
| 74 | |
| 75 | /** 取当前历史条目的稳定 key;首次到达该条目时生成并写回 history.state。 */ |
| 76 | export function currentEntryKey(): string { |
| 77 | if (typeof window === "undefined") return "ssr"; |
| 78 | const existing = readState().__kbScrollKey; |
| 79 | if (typeof existing === "string") return existing; |
| 80 | const key = mintKey(); |
| 81 | stampEntryKey(key); |
| 82 | return key; |
| 83 | } |
| 84 | |
| 85 | /** |
| 86 | * 强制给当前历史条目发一个全新 key 并写回 state(覆盖原有的)。 |
no test coverage detected