(
type: 'push' | 'replace',
destHref: string,
state: any,
)
| 369 | |
| 370 | // This function queues up a call to update the browser history |
| 371 | const queueHistoryAction = ( |
| 372 | type: 'push' | 'replace', |
| 373 | destHref: string, |
| 374 | state: any, |
| 375 | ) => { |
| 376 | const href = createHref(destHref) |
| 377 | |
| 378 | if (!scheduled) { |
| 379 | rollbackLocation = currentLocation |
| 380 | } |
| 381 | |
| 382 | // Update the location in memory |
| 383 | currentLocation = parseHref(destHref, state) |
| 384 | |
| 385 | // Keep track of the next location we need to flush to the URL |
| 386 | next = { |
| 387 | href, |
| 388 | state, |
| 389 | isPush: next?.isPush || type === 'push', |
| 390 | } |
| 391 | |
| 392 | if (!scheduled) { |
| 393 | // Schedule an update to the browser history |
| 394 | scheduled = Promise.resolve().then(() => flush()) |
| 395 | } |
| 396 | } |
| 397 | |
| 398 | // NOTE: this function can probably be removed |
| 399 | const onPushPop = (type: 'PUSH' | 'REPLACE') => { |
no test coverage detected