Files
sshwifty-udp-telnet-http/ui/home_historyctl.js
2019-08-07 15:56:51 +08:00

23 lines
443 B
JavaScript

import { History } from "./commands/history.js";
export function build(ctx) {
let rec = JSON.parse(localStorage.getItem("knowns"));
if (!rec) {
rec = [];
}
return new History(
rec,
(h, d) => {
try {
localStorage.setItem("knowns", JSON.stringify(d));
ctx.connector.knowns = h.all();
} catch (e) {
alert("Unable to save remote history due to error: " + e);
}
},
32
);
}