mirror of
https://github.com/mehotkhan/BandersnatchInteractive.git
synced 2025-07-27 17:23:22 +00:00
assets/scripts.js: Initialize persistent state from data
Fixes JS errors when seeking past first choice with empty localStorage.
This commit is contained in:
parent
9ea55f3c02
commit
9bf91b095b
1 changed files with 5 additions and 0 deletions
|
@ -34,6 +34,11 @@ var segmentGroups = bv.segmentGroups;
|
|||
|
||||
// Persistent state
|
||||
var ls = window.localStorage || {};
|
||||
if (!('initialized' in ls)) {
|
||||
for (let k in bv.stateHistory)
|
||||
ls["persistentState_" + k] = JSON.stringify(bv.stateHistory[k]);
|
||||
ls['initialized'] = 't';
|
||||
}
|
||||
|
||||
function msToString(ms) {
|
||||
return new Date(ms).toUTCString().split(' ')[4];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue