Const correctness for private members

This commit is contained in:
Ian Gulliver
2014-06-15 14:46:06 -07:00
parent bf07fc6196
commit 3629f3c266

View File

@@ -50,22 +50,26 @@ var Cosmopolite = function(
opt_callbacks, opt_urlPrefix, opt_namespace, opt_trackingID) { opt_callbacks, opt_urlPrefix, opt_namespace, opt_trackingID) {
/** /**
* @type {Cosmopolite.typeCallbacks} * @type {Cosmopolite.typeCallbacks}
* @const
* @private * @private
*/ */
this.callbacks_ = this.callbacks_ =
opt_callbacks || /** @type {Cosmopolite.typeCallbacks} */ ({}); opt_callbacks || /** @type {Cosmopolite.typeCallbacks} */ ({});
/** /**
* @type {string} * @type {string}
* @const
* @private * @private
*/ */
this.urlPrefix_ = opt_urlPrefix || '/cosmopolite'; this.urlPrefix_ = opt_urlPrefix || '/cosmopolite';
/** /**
* @type {string} * @type {string}
* @const
* @private * @private
*/ */
this.namespace_ = opt_namespace || 'cosmopolite'; this.namespace_ = opt_namespace || 'cosmopolite';
/** /**
* @type {?string} * @type {?string}
* @const
* @private * @private
*/ */
this.trackingID_ = opt_trackingID || null; this.trackingID_ = opt_trackingID || null;
@@ -83,16 +87,19 @@ var Cosmopolite = function(
/** /**
* @type {Object.<string, Cosmopolite.typeSubscription_>} * @type {Object.<string, Cosmopolite.typeSubscription_>}
* @const
* @private * @private
*/ */
this.subscriptions_ = {}; this.subscriptions_ = {};
/** /**
* @type {Object.<string, Cosmopolite.typeMessage>} * @type {Object.<string, Cosmopolite.typeMessage>}
* @const
* @private * @private
*/ */
this.pins_ = {}; this.pins_ = {};
/** /**
* @type {Array.<function(string)>} * @type {Array.<function(string)>}
* @const
* @private * @private
*/ */
this.profilePromises_ = []; this.profilePromises_ = [];
@@ -114,6 +121,7 @@ var Cosmopolite = function(
/** /**
* @type {string} * @type {string}
* @const
* @private * @private
*/ */
this.messageQueueKey_ = this.namespace_ + ':message_queue'; this.messageQueueKey_ = this.namespace_ + ':message_queue';
@@ -1262,7 +1270,7 @@ Cosmopolite.prototype.onServerEvent_ = function(e) {
this.profilePromises_.forEach(function(resolve) { this.profilePromises_.forEach(function(resolve) {
resolve(this.profile_); resolve(this.profile_);
}, this); }, this);
this.profilePromises_ = []; this.profilePromises_.length = 0;
} }
switch (e['event_type']) { switch (e['event_type']) {
case 'close': case 'close':