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.
|
// flaky. Now we simply poll the shit out of the healthcheck endpoint.
|
||||||
export function initDevReloader(healthzAddr, pollIntervalMs = 500) {
|
export function initDevReloader(healthzAddr, pollIntervalMs = 500) {
|
||||||
// State model is implemented with variables and closures.
|
// State model is implemented with variables and closures.
|
||||||
let auto = true;
|
let auto = !!sessionStorage.getItem("__dev_reloader_auto");
|
||||||
let connected = false;
|
let connected = false;
|
||||||
let initialized = false;
|
let initialized = false;
|
||||||
let interval;
|
let interval;
|
||||||
|
|
@ -41,6 +41,7 @@ export function initDevReloader(healthzAddr, pollIntervalMs = 500) {
|
||||||
|
|
||||||
function toggleAuto() {
|
function toggleAuto() {
|
||||||
auto = !auto;
|
auto = !auto;
|
||||||
|
sessionStorage.setItem("__dev_reloader_auto", auto ? "present" : "");
|
||||||
if (auto && !interval) {
|
if (auto && !interval) {
|
||||||
startInterval();
|
startInterval();
|
||||||
} else if (!auto && interval) {
|
} else if (!auto && interval) {
|
||||||
|
|
@ -84,5 +85,7 @@ export function initDevReloader(healthzAddr, pollIntervalMs = 500) {
|
||||||
button.appendChild(label);
|
button.appendChild(label);
|
||||||
document.body.appendChild(button);
|
document.body.appendChild(button);
|
||||||
|
|
||||||
startInterval();
|
if (auto) {
|
||||||
|
startInterval();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue