store persistent data in sessionStorage instead of localStorage
closes #17
This commit is contained in:
parent
e7e848daeb
commit
ffd762f08f
|
@ -3,11 +3,11 @@
|
||||||
import { navigationMap } from "/navmap.js";
|
import { navigationMap } from "/navmap.js";
|
||||||
|
|
||||||
const branchStateKey = "treehouse.openBranches";
|
const branchStateKey = "treehouse.openBranches";
|
||||||
let branchState = JSON.parse(localStorage.getItem(branchStateKey)) || {};
|
let branchState = JSON.parse(sessionStorage.getItem(branchStateKey)) || {};
|
||||||
|
|
||||||
function saveBranchIsOpen(branchID, state) {
|
function saveBranchIsOpen(branchID, state) {
|
||||||
branchState[branchID] = state;
|
branchState[branchID] = state;
|
||||||
localStorage.setItem(branchStateKey, JSON.stringify(branchState));
|
sessionStorage.setItem(branchStateKey, JSON.stringify(branchState));
|
||||||
}
|
}
|
||||||
|
|
||||||
function branchIsOpen(branchID) {
|
function branchIsOpen(branchID) {
|
||||||
|
|
Loading…
Reference in a new issue