Add warning message when window.localStorage is disabled

This commit is contained in:
NI
2019-09-02 13:20:57 +08:00
parent b1cd29cc27
commit f0d097ab12

View File

@@ -1,10 +1,16 @@
import { History } from "./commands/history.js"; import { History } from "./commands/history.js";
export function build(ctx) { export function build(ctx) {
let rec = JSON.parse(localStorage.getItem("knowns")); let rec = [];
if (!rec) { try {
rec = []; rec = JSON.parse(localStorage.getItem("knowns"));
if (!rec) {
rec = [];
}
} catch (e) {
alert("Unable to load data of Known remotes: " + e);
} }
return new History( return new History(