Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(584)

Unified Diff: remoting/webapp/me2mom/xhr.js

Issue 8336004: Improve web-app type safety. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/webapp/me2mom/wcs_loader.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/webapp/me2mom/xhr.js
diff --git a/remoting/webapp/me2mom/xhr.js b/remoting/webapp/me2mom/xhr.js
index 0353bb00bb4d99f7c90f9902a960fe412fdd3211..46edcaaa9baf2d1ac1c15e1794f825a35829bb4b 100644
--- a/remoting/webapp/me2mom/xhr.js
+++ b/remoting/webapp/me2mom/xhr.js
@@ -13,10 +13,9 @@
var remoting = remoting || {};
/** Namespace for XHR functions */
+/** @type {Object} */
remoting.xhr = remoting.xhr || {};
-(function() {
-
/**
* Takes an associative array of parameters and urlencodes it.
*
@@ -33,7 +32,7 @@ remoting.xhr.urlencodeParamHash = function(paramHash) {
return paramArray.join('&');
}
return '';
-}
+};
/**
* Execute an XHR GET asynchronously.
@@ -41,17 +40,18 @@ remoting.xhr.urlencodeParamHash = function(paramHash) {
* @param {string} url The base URL to GET, excluding parameters.
* @param {function(XMLHttpRequest):void} onDone The function to call on
* completion.
- * @param {(string|Object.<string>)} opt_parameters The request parameters,
+ * @param {(string|Object.<string>)=} opt_parameters The request parameters,
* either as an associative array, or a string. If it is a string, do
* not include the ? and be sure it is correctly URLEncoded.
- * @param {Object.<string>} opt_headers Additional headers to include on the
+ * @param {Object.<string>=} opt_headers Additional headers to include on the
* request.
- * @param {boolean} opt_withCredentials Set the withCredentials flags in the
+ * @param {boolean=} opt_withCredentials Set the withCredentials flags in the
* XHR.
* @return {XMLHttpRequest} The request object.
*/
remoting.xhr.get = function(url, onDone, opt_parameters, opt_headers,
opt_withCredentials) {
+ /** @type {XMLHttpRequest} */
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
if (xhr.readyState != 4) {
@@ -95,7 +95,7 @@ remoting.xhr.get = function(url, onDone, opt_parameters, opt_headers,
xhr.send(null);
return xhr;
-}
+};
/**
* Execute an XHR POST asynchronously.
@@ -103,17 +103,18 @@ remoting.xhr.get = function(url, onDone, opt_parameters, opt_headers,
* @param {string} url The base URL to POST, excluding parameters.
* @param {function(XMLHttpRequest):void} onDone The function to call on
* completion.
- * @param {(string|Object.<string>)} opt_parameters The request parameters,
+ * @param {(string|Object.<string>)=} opt_parameters The request parameters,
* either as an associative array, or a string. If it is a string, be
* sure it is correctly URLEncoded.
- * @param {Object.<string>} opt_headers Additional headers to include on the
+ * @param {Object.<string>=} opt_headers Additional headers to include on the
* request.
- * @param {boolean} opt_withCredentials Set the withCredentials flags in the
+ * @param {boolean=} opt_withCredentials Set the withCredentials flags in the
* XHR.
* @return {void} Nothing.
*/
remoting.xhr.post = function(url, onDone, opt_parameters, opt_headers,
opt_withCredentials) {
+ /** @type {XMLHttpRequest} */
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
if (xhr.readyState != 4) {
@@ -153,6 +154,4 @@ remoting.xhr.post = function(url, onDone, opt_parameters, opt_headers,
}
xhr.send(postData);
-}
-
-}());
+};
« no previous file with comments | « remoting/webapp/me2mom/wcs_loader.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698