Created
May 2, 2025 14:34
-
-
Save derekmc/d8bbd04229a45e6c4b4924605ae9591a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let data = {} | |
let items = {} | |
let env = {} | |
let DATA_KEY = "__APP_DATA:0.0.1__" | |
function init(){ | |
data.x ??= 0 | |
data.y ??= 0 | |
} | |
function save(){ | |
data.__items = {} | |
for(let k in items){ | |
let x = items[k].save() | |
data.__items[k] = x | |
} | |
let x = JSON.stringify(data) | |
localStorage.setItem(DATA_KEY, x) | |
} | |
function load(){ | |
try{ | |
let x = JSON.parse(localStorage.getItem(DATA_KEY)) | |
data = x | |
for(let k in data.__items | |
}catch(e){ | |
console.error(e) | |
console.error('load error') | |
} | |
} | |
function main(){ | |
} | |
function page1(data){ | |
} | |
function draw(){ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment