Better mode switch message
This commit is contained in:
parent
cec8c327bf
commit
7b56df523b
@ -20,6 +20,7 @@ import type { Client } from "./client.ts";
|
|||||||
import { Panel } from "./components/panel.tsx";
|
import { Panel } from "./components/panel.tsx";
|
||||||
import { h } from "./deps.ts";
|
import { h } from "./deps.ts";
|
||||||
import { async } from "https://cdn.skypack.dev/-/regenerator-runtime@v0.13.9-4Dxus9nU31cBsHxnWq2H/dist=es2020,mode=imports/optimized/regenerator-runtime.js";
|
import { async } from "https://cdn.skypack.dev/-/regenerator-runtime@v0.13.9-4Dxus9nU31cBsHxnWq2H/dist=es2020,mode=imports/optimized/regenerator-runtime.js";
|
||||||
|
import { sleep } from "$sb/lib/async.ts";
|
||||||
|
|
||||||
export class MainUI {
|
export class MainUI {
|
||||||
viewState: AppViewState = initialViewState;
|
viewState: AppViewState = initialViewState;
|
||||||
@ -217,23 +218,19 @@ export class MainUI {
|
|||||||
const newValue = !this.editor.syncMode;
|
const newValue = !this.editor.syncMode;
|
||||||
|
|
||||||
if (newValue) {
|
if (newValue) {
|
||||||
if (
|
localStorage.setItem("syncMode", "true");
|
||||||
await this.editor.confirm(
|
this.editor.flashNotification(
|
||||||
"This will enable local sync. Are you sure?",
|
"Now switching to sync mode, one moment please...",
|
||||||
)
|
);
|
||||||
) {
|
await sleep(1000);
|
||||||
localStorage.setItem("syncMode", "true");
|
location.reload();
|
||||||
location.reload();
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if (
|
localStorage.removeItem("syncMode");
|
||||||
await this.editor.confirm(
|
this.editor.flashNotification(
|
||||||
"This will disable local sync. Are you sure?",
|
"Now switching to server mode, one moment please...",
|
||||||
)
|
);
|
||||||
) {
|
await sleep(1000);
|
||||||
localStorage.removeItem("syncMode");
|
location.reload();
|
||||||
location.reload();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})().catch(console.error);
|
})().catch(console.error);
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user