From 3629f3c2662a2b45a1de933c77035ca78de31d43 Mon Sep 17 00:00:00 2001 From: Ian Gulliver Date: Sun, 15 Jun 2014 14:46:06 -0700 Subject: [PATCH] Const correctness for private members --- static/cosmopolite.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/static/cosmopolite.js b/static/cosmopolite.js index 8c848bf..87f0b26 100644 --- a/static/cosmopolite.js +++ b/static/cosmopolite.js @@ -50,22 +50,26 @@ var Cosmopolite = function( opt_callbacks, opt_urlPrefix, opt_namespace, opt_trackingID) { /** * @type {Cosmopolite.typeCallbacks} + * @const * @private */ this.callbacks_ = opt_callbacks || /** @type {Cosmopolite.typeCallbacks} */ ({}); /** * @type {string} + * @const * @private */ this.urlPrefix_ = opt_urlPrefix || '/cosmopolite'; /** * @type {string} + * @const * @private */ this.namespace_ = opt_namespace || 'cosmopolite'; /** * @type {?string} + * @const * @private */ this.trackingID_ = opt_trackingID || null; @@ -83,16 +87,19 @@ var Cosmopolite = function( /** * @type {Object.} + * @const * @private */ this.subscriptions_ = {}; /** * @type {Object.} + * @const * @private */ this.pins_ = {}; /** * @type {Array.} + * @const * @private */ this.profilePromises_ = []; @@ -114,6 +121,7 @@ var Cosmopolite = function( /** * @type {string} + * @const * @private */ this.messageQueueKey_ = this.namespace_ + ':message_queue'; @@ -1262,7 +1270,7 @@ Cosmopolite.prototype.onServerEvent_ = function(e) { this.profilePromises_.forEach(function(resolve) { resolve(this.profile_); }, this); - this.profilePromises_ = []; + this.profilePromises_.length = 0; } switch (e['event_type']) { case 'close':