manages browsing session history jsr.io/@mary/history
typescript jsr
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

refactor!: rename key to id

this will make sense later

Mary 575882c9 095d085e

+6 -6
+6 -6
lib/mod.ts
··· 36 36 /** A value of arbitrary data associated with this location. */ 37 37 state: unknown; 38 38 /** A unique string associated with this location */ 39 - key: string; 39 + id: string; 40 40 } 41 41 42 42 /** ··· 133 133 134 134 interface HistoryState { 135 135 usr: unknown; 136 - key?: string; 136 + id?: string; 137 137 idx: number; 138 138 } 139 139 ··· 167 167 hash, 168 168 index: state.idx, 169 169 state: state.usr || null, 170 - key: state.key || 'default', 170 + id: state.id || 'default', 171 171 }; 172 172 }; 173 173 ··· 239 239 ...(typeof to === 'string' ? parsePath(to) : to), 240 240 index, 241 241 state, 242 - key: createKey(), 242 + id: randomId(), 243 243 }; 244 244 }; 245 245 ··· 247 247 return [ 248 248 { 249 249 usr: nextLocation.state, 250 - key: nextLocation.key, 250 + id: nextLocation.id, 251 251 idx: nextLocation.index, 252 252 }, 253 253 createHref(nextLocation), ··· 353 353 event.preventDefault(); 354 354 }; 355 355 356 - const createKey = () => { 356 + const randomId = () => { 357 357 return nanoid(); 358 358 }; 359 359