mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-11-13 07:53:45 +08:00
00364fd645
Separate Galaxy authentication and local access policy from web presentation. Co-authored-by: Danny <dannyirwin31@yahoo.com> Co-authored-by: Prabhaav Pillai <prabhaav@msu.edu> Co-authored-by: dirwin31 <83434411+dirwin31@users.noreply.github.com> Co-authored-by: firestarsdog <229254897+firestarsdog@users.noreply.github.com>
9 lines
362 B
JavaScript
9 lines
362 B
JavaScript
// Keep unsaved drafts and pending saves on the page, including during host live reload.
|
|
export function guardUnload(shouldBlock) {
|
|
const listener = event => {
|
|
if (shouldBlock()) { event.preventDefault(); event.returnValue = "" }
|
|
}
|
|
window.addEventListener("beforeunload", listener)
|
|
return () => window.removeEventListener("beforeunload", listener)
|
|
}
|