X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/7a654f8d43fdb43d78b63d90528bed6e86b608cc..6746dc89c47ed01b165cc1152533605f97eb8e8d:/docs/source/JsonP.html?ds=sidebyside diff --git a/docs/source/JsonP.html b/docs/source/JsonP.html index 3423c4d5..b391258f 100644 --- a/docs/source/JsonP.html +++ b/docs/source/JsonP.html @@ -1,4 +1,21 @@ -Sencha Documentation Project
/**
+
+
+
+  
+  The source code
+  
+  
+  
+  
+
+
+  
/**
  * @class Ext.data.JsonP
  * @singleton
  * This class is used to create JSONP requests. JSONP is a mechanism that allows for making
@@ -18,7 +35,7 @@ Ext.define('Ext.data.JsonP', {
     
     /* End Definitions */
     
-    /**
+    /**
      * @property timeout
      * @type Number
      * A default timeout for any JsonP requests. If the request has not completed in this time the
@@ -26,21 +43,21 @@ Ext.define('Ext.data.JsonP', {
      */
     timeout: 30000,
     
-    /**
+    /**
      * @property disableCaching
      * @type Boolean
      * True to add a unique cache-buster param to requests. Defaults to <tt>true</tt>.
      */
     disableCaching: true,
    
-    /**
+    /**
      * @property disableCachingParam 
      * @type String
      * Change the parameter which is sent went disabling caching through a cache buster. Defaults to <tt>'_dc'</tt>.
      */
     disableCachingParam: '_dc',
    
-    /**
+    /**
      * @property callbackKey
      * @type String
      * Specifies the GET parameter that will be sent to the server containing the function name to be executed when
@@ -49,7 +66,7 @@ Ext.define('Ext.data.JsonP', {
      */
     callbackKey: 'callback',
    
-    /**
+    /**
      * Makes a JSONP request.
      * @param {Object} options An object which may contain the following properties. Note that options will
      * take priority over any defaults that are specified in the class.
@@ -59,6 +76,11 @@ Ext.define('Ext.data.JsonP', {
      * key value pairs that will be sent along with the request.</div></li>
      * <li><b>timeout</b> : Number (Optional) <div class="sub-desc">See {@link #timeout}</div></li>
      * <li><b>callbackKey</b> : String (Optional) <div class="sub-desc">See {@link #callbackKey}</div></li>
+     * <li><b>callbackName</b> : String (Optional) <div class="sub-desc">The function name to use for this request.
+     * By default this name will be auto-generated: Ext.data.JsonP.callback1, Ext.data.JsonP.callback2, etc.
+     * Setting this option to "my_name" will force the function name to be Ext.data.JsonP.my_name.
+     * Use this if you want deterministic behavior, but be careful - the callbackName should be different
+     * in each JsonP request that you make.</div></li>
      * <li><b>disableCaching</b> : Boolean (Optional) <div class="sub-desc">See {@link #disableCaching}</div></li>
      * <li><b>disableCachingParam</b> : String (Optional) <div class="sub-desc">See {@link #disableCachingParam}</div></li>
      * <li><b>success</b> : Function (Optional) <div class="sub-desc">A function to execute if the request succeeds.</div></li>
@@ -83,7 +105,7 @@ Ext.define('Ext.data.JsonP', {
             disableCaching = Ext.isDefined(options.disableCaching) ? options.disableCaching : me.disableCaching, 
             cacheParam = options.disableCachingParam || me.disableCachingParam, 
             id = ++me.statics().requestCount, 
-            callbackName = 'callback' + id, 
+            callbackName = options.callbackName || 'callback' + id, 
             callbackKey = options.callbackKey || me.callbackKey, 
             timeout = Ext.isDefined(options.timeout) ? options.timeout : me.timeout, 
             params = Ext.apply({}, options.params), 
@@ -120,7 +142,7 @@ Ext.define('Ext.data.JsonP', {
         return request;
     },
     
-    /**
+    /**
      * Abort a request. If the request parameter is not specified all open requests will
      * be aborted.
      * @param {Object/String} request (Optional) The request to abort
@@ -143,7 +165,7 @@ Ext.define('Ext.data.JsonP', {
         }
     },
     
-    /**
+    /**
      * Sets up error handling for the script
      * @private
      * @param {Object} request The request
@@ -152,7 +174,7 @@ Ext.define('Ext.data.JsonP', {
         request.script.onerror = Ext.bind(this.handleError, this, [request]);
     },
     
-    /**
+    /**
      * Handles any aborts when loading the script
      * @private
      * @param {Object} request The request
@@ -162,7 +184,7 @@ Ext.define('Ext.data.JsonP', {
         this.handleResponse(null, request);
     },
     
-    /**
+    /**
      * Handles any script errors when loading the script
      * @private
      * @param {Object} request The request
@@ -172,7 +194,7 @@ Ext.define('Ext.data.JsonP', {
         this.handleResponse(null, request);
     },
  
-    /**
+    /**
      * Cleans up anu script handling errors
      * @private
      * @param {Object} request The request
@@ -181,7 +203,7 @@ Ext.define('Ext.data.JsonP', {
         request.script.onerror = null;
     },
  
-    /**
+    /**
      * Handle any script timeouts
      * @private
      * @param {Object} request The request
@@ -191,7 +213,7 @@ Ext.define('Ext.data.JsonP', {
         this.handleResponse(null, request);
     },
  
-    /**
+    /**
      * Handle a successful response
      * @private
      * @param {Object} result The result from the request
@@ -218,7 +240,7 @@ Ext.define('Ext.data.JsonP', {
         Ext.callback(request.callback, request.scope, [success, result, request.errorType]);
     },
     
-    /**
+    /**
      * Create the script tag
      * @private
      * @param {String} url The url of the request
@@ -232,4 +254,6 @@ Ext.define('Ext.data.JsonP', {
         return script;
     }
 });
-
\ No newline at end of file +
+ +