mirror of
https://github.com/jkingsman/Remote-Terminal-for-MeshCore.git
synced 2026-08-07 01:03:34 +02:00
(feat) chain app nav to browser history state. Closes #250.
Hook browser back/forward to nav state
This commit is contained in:
@@ -172,9 +172,25 @@ export function updateUrlHash(conv: Conversation | null): void {
|
||||
}
|
||||
}
|
||||
|
||||
// Update URL hash and add a new browser history entry
|
||||
export function pushUrlHash(conv: Conversation | null): void {
|
||||
const newHash = getConversationHash(conv);
|
||||
if (newHash !== window.location.hash) {
|
||||
window.history.pushState(null, '', newHash || window.location.pathname);
|
||||
}
|
||||
}
|
||||
|
||||
export function updateSettingsHash(section: SettingsSection): void {
|
||||
const newHash = getSettingsHash(section);
|
||||
if (newHash !== window.location.hash) {
|
||||
window.history.replaceState(null, '', newHash);
|
||||
}
|
||||
}
|
||||
|
||||
// Push a settings hash as a new browser history entry
|
||||
export function pushSettingsHash(section: SettingsSection): void {
|
||||
const newHash = getSettingsHash(section);
|
||||
if (newHash !== window.location.hash) {
|
||||
window.history.pushState(null, '', newHash);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user