Implement Ctrl-R/F5 reload handler with intent to allow reloads in GUI build.
This commit is contained in:
@@ -6,10 +6,27 @@ import { installKeyboardNavigation } from "./composables/useKeyboardNavigation"
|
|||||||
import { installGamepadNavigation } from "./composables/useGamepadNavigation"
|
import { installGamepadNavigation } from "./composables/useGamepadNavigation"
|
||||||
import { installInputModalityTracking } from "./composables/useInputModality"
|
import { installInputModalityTracking } from "./composables/useInputModality"
|
||||||
|
|
||||||
|
function installReloadShortcut() {
|
||||||
|
document.addEventListener(
|
||||||
|
"keydown",
|
||||||
|
(event) => {
|
||||||
|
if (
|
||||||
|
event.key === "F5" ||
|
||||||
|
((event.ctrlKey || event.metaKey) && event.key.toLowerCase() === "r")
|
||||||
|
) {
|
||||||
|
event.preventDefault()
|
||||||
|
window.location.reload()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ capture: true },
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
// Install global keyboard navigation handlers immediately
|
// Install global keyboard navigation handlers immediately
|
||||||
installInputModalityTracking()
|
installInputModalityTracking()
|
||||||
installKeyboardNavigation()
|
installKeyboardNavigation()
|
||||||
installGamepadNavigation()
|
installGamepadNavigation()
|
||||||
|
installReloadShortcut()
|
||||||
|
|
||||||
// Unregister any legacy service workers — MediaHive no longer uses a PWA/SW.
|
// Unregister any legacy service workers — MediaHive no longer uses a PWA/SW.
|
||||||
if ("serviceWorker" in navigator) {
|
if ("serviceWorker" in navigator) {
|
||||||
|
|||||||
Reference in New Issue
Block a user