state: store quickstate in client localStorage

This commit is contained in:
bordun 2020-03-24 11:47:10 +01:00
parent c3d3842840
commit 7c580b90e7
2 changed files with 6 additions and 1 deletions

View file

@ -94,6 +94,10 @@
- added `storage` object, proxy to the document's sessionStorage object (allows storing data that persist after page refresh, but not closing)
- added `setTimeout`, `clearTimeout`, `setInterval`, `clearInterval` function proxies with an extra `id` argument (they clear automatically when called multiple times and upon widget removal. `id` is scoped to the widget)
- state
- quickstate (store/recall from menu) is now stored in the clients cache and persists after refresh/close (cleared with the browser's cache)
- custom module
- `settings.read(name)`: `name` is now the long name of command-line options (not a camelCased one)

View file

@ -15,7 +15,7 @@ var StateManager = class StateManager {
this.statePath = ''
this.lastDir = null
this.quickState = null
this.quickState = JSON.parse(localStorage.getItem('osc.state.quickState')) || null
this.valueStateQueue = {}
this.valueOldPropQueue = {}
@ -182,6 +182,7 @@ var StateManager = class StateManager {
quickSave() {
this.quickState = deepCopy(this.get())
localStorage.setItem('osc.state.quickState', JSON.stringify(this.quickState))
}