code: function(key, type, callback) {
  		return function(value) {
  			try {
  				if ( value != null || type === 'string' ) {
  					if (value) {
  						localStorage.setItem(key, type === 'boolean' ? 'X' : value);
  					} else {
  						localStorage.removeItem(key);
  					}
  					callback(value);
  				}
  				value = localStorage.getItem(key);
  				return type === 'boolean' ? value === 'X' : value;
  			} catch (e) {
  				Log.warning("Could not access localStorage while accessing '" + key + "' (value: '" + value + "', are cookies disabled?): " + e.message);
  			}
  		};
  	}
docs: Reads the value for the given key from the localStorage or writes a new value to it.