@samitouri / QOSami-HFS / commits / c8ea28e2

warning if page is left during upload

Massimo Melina committed Sep 23, 2023 at 00:14 UTC c8ea28e2624e316f11bf926275cf639c136c612f
1 file changed +6
frontend/src/upload.ts
+6
@@ -64,6 +64,12 @@ setInterval(() => {
64 uploadState.eta = uploadState.speed && Math.round(left / uploadState.speed)
65 }, 5_000)
66
67 +window.onbeforeunload = e => {
68 + if (!uploadState.qs.length) return
69 + e.preventDefault()
70 + return e.returnValue = t("Uploading") // modern browsers ignore this message
71 +}
72 +
73 let reloadOnClose = false
74 let uploadDialogIsOpen = false
75 let everPaused = false