You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For convenience, it would be nice to have persistent values on controls. When the user reloads the page, the values can be loaded back in from localStorage.
ui.add('title', { name:'Title', persist: true});
The text was updated successfully, but these errors were encountered:
I'm not sure whether datastorage needs to be part of an ui-library.
Why not just use the callbacks.
For example, something like this:
var data = {}
function load(){
var d = window.localStorage.getItem('data')
if( d ) data = JSON.parse(d)
}
function save(key,value){ // key will be preloaded by bind(..) later
data[key] = value
window.localStorage.setItem('data', JSON.stringify(data) )
}
// init UIL
load()
for( var key in data )
ui.add(i,{name:key, value: data[key], callback: save.bind(null,key) })
For convenience, it would be nice to have persistent values on controls. When the user reloads the page, the values can be loaded back in from localStorage.
ui.add('title', { name:'Title', persist: true});
The text was updated successfully, but these errors were encountered: