4 var services = app.ns("services");
6 services.Preferences = ux.Singleton.extend({
8 this._storage = window.localStorage;
9 this._setItem("__version", 1 );
11 get: function( key ) {
12 return this._getItem( key );
14 set: function( key, val ) {
15 return this._setItem( key, val );
17 _getItem: function( key ) {
19 return JSON.parse( this._storage.getItem( key ) );
25 _setItem: function( key, val ) {
27 return this._storage.setItem( key, JSON.stringify( val ) );