X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/6746dc89c47ed01b165cc1152533605f97eb8e8d..f562e4c6e5fac7bcb445985b99acbea4d706e6f0:/docs/source/WebStorage.html diff --git a/docs/source/WebStorage.html b/docs/source/WebStorage.html index 2cea1990..1fb9d403 100644 --- a/docs/source/WebStorage.html +++ b/docs/source/WebStorage.html @@ -3,8 +3,8 @@ The source code - - + + @@ -17,33 +17,32 @@
/**
  * @author Ed Spencer
- * @class Ext.data.proxy.WebStorage
- * @extends Ext.data.proxy.Client
- * 
- * <p>WebStorageProxy is simply a superclass for the {@link Ext.data.proxy.LocalStorage localStorage} and 
- * {@link Ext.data.proxy.SessionStorage sessionStorage} proxies. It uses the new HTML5 key/value client-side storage 
- * objects to save {@link Ext.data.Model model instances} for offline use.</p>
+ *
+ * WebStorageProxy is simply a superclass for the {@link Ext.data.proxy.LocalStorage LocalStorage} and {@link
+ * Ext.data.proxy.SessionStorage SessionStorage} proxies. It uses the new HTML5 key/value client-side storage objects to
+ * save {@link Ext.data.Model model instances} for offline use.
+ * @private
  */
 Ext.define('Ext.data.proxy.WebStorage', {
     extend: 'Ext.data.proxy.Client',
     alternateClassName: 'Ext.data.WebStorageProxy',
-    
+
     /**
-     * @cfg {String} id The unique ID used as the key in which all record data are stored in the local storage object
+     * @cfg {String} id
+     * The unique ID used as the key in which all record data are stored in the local storage object.
      */
     id: undefined,
 
     /**
-     * Creates the proxy, throws an error if local storage is not supported in the current browser
+     * Creates the proxy, throws an error if local storage is not supported in the current browser.
      * @param {Object} config (optional) Config object.
      */
     constructor: function(config) {
         this.callParent(arguments);
-        
+
         /**
-         * Cached map of records already retrieved by this Proxy - ensures that the same instance is always retrieved
-         * @property cache
-         * @type Object
+         * @property {Object} cache
+         * Cached map of records already retrieved by this Proxy. Ensures that the same instance is always retrieved.
          */
         this.cache = {};
 
@@ -71,7 +70,7 @@ Ext.define('Ext.data.proxy.WebStorage', {
             length  = records.length,
             ids     = this.getIds(),
             id, record, i;
-        
+
         operation.setStarted();
 
         for (i = 0; i < length; i++) {
@@ -106,11 +105,11 @@ Ext.define('Ext.data.proxy.WebStorage', {
             ids     = this.getIds(),
             length  = ids.length,
             i, recordData, record;
-        
+
         //read a single record
         if (operation.id) {
             record = this.getRecord(operation.id);
-            
+
             if (record) {
                 records.push(record);
                 operation.setSuccessful();
@@ -121,7 +120,7 @@ Ext.define('Ext.data.proxy.WebStorage', {
             }
             operation.setSuccessful();
         }
-        
+
         operation.setCompleted();
 
         operation.resultSet = Ext.create('Ext.data.ResultSet', {
@@ -147,7 +146,7 @@ Ext.define('Ext.data.proxy.WebStorage', {
         for (i = 0; i < length; i++) {
             record = records[i];
             this.setRecord(record);
-            
+
             //we need to update the set of ids here because it's possible that a non-phantom record was added
             //to this proxy - in which case the record's id would never have been added via the normal 'create' call
             id = record.getId();
@@ -181,7 +180,7 @@ Ext.define('Ext.data.proxy.WebStorage', {
         }
 
         this.setIds(newIds);
-        
+
         operation.setCompleted();
         operation.setSuccessful();
 
@@ -192,7 +191,7 @@ Ext.define('Ext.data.proxy.WebStorage', {
 
     /**
      * @private
-     * Fetches a model instance from the Proxy by ID. Runs each field's decode function (if present) to decode the data
+     * Fetches a model instance from the Proxy by ID. Runs each field's decode function (if present) to decode the data.
      * @param {String} id The record's unique ID
      * @return {Ext.data.Model} The model instance
      */
@@ -221,14 +220,14 @@ Ext.define('Ext.data.proxy.WebStorage', {
 
             this.cache[id] = record;
         }
-        
+
         return this.cache[id];
     },
 
     /**
-     * Saves the given record in the Proxy. Runs each field's encode function (if present) to encode the data
+     * Saves the given record in the Proxy. Runs each field's encode function (if present) to encode the data.
      * @param {Ext.data.Model} record The model instance
-     * @param {String} id The id to save the record under (defaults to the value of the record's getId() function)
+     * @param {String} [id] The id to save the record under (defaults to the value of the record's getId() function)
      */
     setRecord: function(record, id) {
         if (id) {
@@ -259,10 +258,10 @@ Ext.define('Ext.data.proxy.WebStorage', {
 
         obj = me.getStorageObject();
         key = me.getRecordKey(id);
-        
+
         //keep the cache up to date
         me.cache[id] = record;
-        
+
         //iPad bug requires that we remove the item before setting it
         obj.removeItem(key);
         obj.setItem(key, Ext.encode(data));
@@ -272,12 +271,12 @@ Ext.define('Ext.data.proxy.WebStorage', {
      * @private
      * Physically removes a given record from the local storage. Used internally by {@link #destroy}, which you should
      * use instead because it updates the list of currently-stored record ids
-     * @param {String|Number|Ext.data.Model} id The id of the record to remove, or an Ext.data.Model instance
+     * @param {String/Number/Ext.data.Model} id The id of the record to remove, or an Ext.data.Model instance
      */
     removeRecord: function(id, updateIds) {
         var me = this,
             ids;
-            
+
         if (id.isModel) {
             id = id.getId();
         }
@@ -295,7 +294,7 @@ Ext.define('Ext.data.proxy.WebStorage', {
      * @private
      * Given the id of a record, returns a unique string based on that id and the id of this proxy. This is used when
      * storing data in the local storage object and should prevent naming collisions.
-     * @param {String|Number|Ext.data.Model} id The record id, or a Model instance
+     * @param {String/Number/Ext.data.Model} id The record id, or a Model instance
      * @return {String} The unique key for this record
      */
     getRecordKey: function(id) {
@@ -319,7 +318,7 @@ Ext.define('Ext.data.proxy.WebStorage', {
     /**
      * @private
      * Returns the array of record IDs stored in this Proxy
-     * @return {Array} The record IDs. Each is cast as a Number
+     * @return {Number[]} The record IDs. Each is cast as a Number
      */
     getIds: function() {
         var ids    = (this.getStorageObject().getItem(this.id) || "").split(","),
@@ -340,14 +339,14 @@ Ext.define('Ext.data.proxy.WebStorage', {
     /**
      * @private
      * Saves the array of ids representing the set of all records in the Proxy
-     * @param {Array} ids The ids to set
+     * @param {Number[]} ids The ids to set
      */
     setIds: function(ids) {
         var obj = this.getStorageObject(),
             str = ids.join(",");
-        
+
         obj.removeItem(this.id);
-        
+
         if (!Ext.isEmpty(str)) {
             obj.setItem(this.id, str);
         }
@@ -355,8 +354,8 @@ Ext.define('Ext.data.proxy.WebStorage', {
 
     /**
      * @private
-     * Returns the next numerical ID that can be used when realizing a model instance (see getRecordCounterKey). Increments
-     * the counter.
+     * Returns the next numerical ID that can be used when realizing a model instance (see getRecordCounterKey).
+     * Increments the counter.
      * @return {Number} The id
      */
     getNextId: function() {
@@ -364,15 +363,15 @@ Ext.define('Ext.data.proxy.WebStorage', {
             key  = this.getRecordCounterKey(),
             last = obj.getItem(key),
             ids, id;
-        
+
         if (last === null) {
             ids = this.getIds();
             last = ids[ids.length - 1] || 0;
         }
-        
+
         id = parseInt(last, 10) + 1;
         obj.setItem(key, id);
-        
+
         return id;
     },
 
@@ -387,7 +386,8 @@ Ext.define('Ext.data.proxy.WebStorage', {
     },
 
     /**
-     * Destroys all records stored in the proxy and removes all keys and values used to support the proxy from the storage object
+     * Destroys all records stored in the proxy and removes all keys and values used to support the proxy from the
+     * storage object.
      */
     clear: function() {
         var obj = this.getStorageObject(),