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

Unified Diff: remoting/webapp/me2mom/wcs_loader.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_iq_client_proto.js ('k') | remoting/webapp/me2mom/xhr.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/webapp/me2mom/wcs_loader.js
diff --git a/remoting/webapp/me2mom/wcs_loader.js b/remoting/webapp/me2mom/wcs_loader.js
index 292301a4147c1e41eb95ce5d5339e50669231e40..a5317db49b43380ed44b987285a183dee420bdc7 100644
--- a/remoting/webapp/me2mom/wcs_loader.js
+++ b/remoting/webapp/me2mom/wcs_loader.js
@@ -14,7 +14,9 @@
/** @suppress {duplicate} */
var remoting = remoting || {};
-(function() {
+/** @type {remoting.WcsLoader} */
+remoting.wcsLoader = null;
+
/**
* @constructor
*/
@@ -28,14 +30,14 @@ remoting.WcsLoader = function() {
/**
* A callback that gets an updated access token asynchronously.
- * @type {function(function(string): void): void}
+ * @param {function(string): void} setToken The function to call when the
+ * token is available.
* @private
*/
this.refreshToken_ = function(setToken) {};
/**
* The function called when WCS is ready.
- * @type {function(): void}
* @private
*/
this.onReady_ = function() {};
@@ -59,7 +61,7 @@ remoting.WcsLoader = function() {
/**
* The WCS client that will be downloaded.
- * @type {Object}
+ * @type {remoting.WcsIqClient}
*/
this.wcsIqClient = null;
};
@@ -103,6 +105,7 @@ remoting.WcsLoader.prototype.start = function(token, refreshToken, onReady) {
var node = document.createElement('script');
node.src = this.TALK_GADGET_URL_ + 'iq?access_token=' + this.token_;
node.type = 'text/javascript';
+ /** @type {remoting.WcsLoader} */
var that = this;
node.onload = function() { that.constructWcs_(); };
document.body.insertBefore(node, document.body.firstChild);
@@ -116,12 +119,16 @@ remoting.WcsLoader.prototype.start = function(token, refreshToken, onReady) {
* @private
*/
remoting.WcsLoader.prototype.constructWcs_ = function() {
+ /** @type {remoting.WcsLoader} */
var that = this;
+ /** @param {function(string): void} setToken The function to call when the
+ token is available. */
+ var refreshToken = function(setToken) { that.refreshToken_(setToken); };
remoting.wcs = new remoting.Wcs(
remoting.wcsLoader.wcsIqClient,
this.token_,
function() { that.onWcsReady_(); },
- function(setToken) { that.refreshToken_(setToken); });
+ refreshToken);
};
/**
@@ -135,5 +142,3 @@ remoting.WcsLoader.prototype.onWcsReady_ = function() {
this.onReady_();
this.onReady_ = function() {};
};
-
-}());
« no previous file with comments | « remoting/webapp/me2mom/wcs_iq_client_proto.js ('k') | remoting/webapp/me2mom/xhr.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698