Skip to content

Commit cd2f784

Browse files
committed
Autoload from local storage, for convenience
1 parent 7660e24 commit cd2f784

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

web/src/title/MapLoader.svelte

+11
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,17 @@
3737
$app = new LTN(new Uint8Array(buffer));
3838
console.timeEnd("load");
3939
40+
// Autoload from local storage
41+
let filename = `ltn_${$example || "custom"}.geojson`;
42+
let gj = window.localStorage.getItem(filename);
43+
if (gj) {
44+
try {
45+
$app.loadSavefile(JSON.parse(gj));
46+
} catch (err) {
47+
console.log(`Didn't restore from local storage ${filename}: ${err}`);
48+
}
49+
}
50+
4051
$mode = {
4152
mode: "network",
4253
};

0 commit comments

Comments
 (0)