persist dev auto-reload setting through session
This commit is contained in:
parent
e031766790
commit
f557654da8
1 changed files with 5 additions and 2 deletions
|
|
@ -2,7 +2,7 @@
|
|||
// flaky. Now we simply poll the shit out of the healthcheck endpoint.
|
||||
export function initDevReloader(healthzAddr, pollIntervalMs = 500) {
|
||||
// State model is implemented with variables and closures.
|
||||
let auto = true;
|
||||
let auto = !!sessionStorage.getItem("__dev_reloader_auto");
|
||||
let connected = false;
|
||||
let initialized = false;
|
||||
let interval;
|
||||
|
|
@ -41,6 +41,7 @@ export function initDevReloader(healthzAddr, pollIntervalMs = 500) {
|
|||
|
||||
function toggleAuto() {
|
||||
auto = !auto;
|
||||
sessionStorage.setItem("__dev_reloader_auto", auto ? "present" : "");
|
||||
if (auto && !interval) {
|
||||
startInterval();
|
||||
} else if (!auto && interval) {
|
||||
|
|
@ -84,5 +85,7 @@ export function initDevReloader(healthzAddr, pollIntervalMs = 500) {
|
|||
button.appendChild(label);
|
||||
document.body.appendChild(button);
|
||||
|
||||
if (auto) {
|
||||
startInterval();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue