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