Whitespace for strict linting.

This commit is contained in:
Ian Gulliver
2014-05-28 21:52:12 -07:00
parent 9e791bcf3b
commit d5941a49f7
2 changed files with 68 additions and 23 deletions

View File

@@ -15,6 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
/** /**
* Java-compatible hash calculation * Java-compatible hash calculation
* *
@@ -36,6 +37,7 @@ String.prototype.hashCode = function() {
}; };
/** /**
* @constructor * @constructor
* @param {?Cosmopolite.typeCallbacks=} callbacks * @param {?Cosmopolite.typeCallbacks=} callbacks
@@ -133,6 +135,7 @@ var Cosmopolite = function(callbacks, urlPrefix, namespace) {
}, this); }, this);
}; };
/** @typedef {{onConnect: (function()|undefined), /** @typedef {{onConnect: (function()|undefined),
onDisconnect: (function()|undefined), onDisconnect: (function()|undefined),
onLogin: (function(string, string)|undefined), onLogin: (function(string, string)|undefined),
@@ -142,21 +145,25 @@ var Cosmopolite = function(callbacks, urlPrefix, namespace) {
onUnpin: (function(Cosmopolite.typeMessage)|undefined)}} */ onUnpin: (function(Cosmopolite.typeMessage)|undefined)}} */
Cosmopolite.typeCallbacks; Cosmopolite.typeCallbacks;
/** /**
* @typedef {{event_type: string}} * @typedef {{event_type: string}}
* @private * @private
*/ */
Cosmopolite.typeEvent_; Cosmopolite.typeEvent_;
/** @typedef {{event_type: string, /** @typedef {{event_type: string,
profile: string, profile: string,
google_user: string}} */ google_user: string}} */
Cosmopolite.typeLogin; Cosmopolite.typeLogin;
/** @typedef {{event_type: string, /** @typedef {{event_type: string,
profile: string}} */ profile: string}} */
Cosmopolite.typeLogout; Cosmopolite.typeLogout;
/** @typedef {{event_type: string, /** @typedef {{event_type: string,
id: number, id: number,
created: number, created: number,
@@ -165,6 +172,7 @@ Cosmopolite.typeLogout;
message: *}} */ message: *}} */
Cosmopolite.typeMessage; Cosmopolite.typeMessage;
/** /**
* @typedef {{command: string, * @typedef {{command: string,
arguments: Object, arguments: Object,
@@ -173,14 +181,17 @@ Cosmopolite.typeMessage;
*/ */
Cosmopolite.typeRPC_; Cosmopolite.typeRPC_;
/** @typedef {{name: string, /** @typedef {{name: string,
readable_only_by: (string|undefined), readable_only_by: (string|undefined),
writable_only_by: (string|undefined)}} */ writable_only_by: (string|undefined)}} */
Cosmopolite.typeSubject; Cosmopolite.typeSubject;
/** @typedef {(Cosmopolite.typeSubject|string|number)} */ /** @typedef {(Cosmopolite.typeSubject|string|number)} */
Cosmopolite.typeSubjectLoose; Cosmopolite.typeSubjectLoose;
/** /**
* @typedef {{messages: Array.<Cosmopolite.typeMessage>, * @typedef {{messages: Array.<Cosmopolite.typeMessage>,
pins: Array.<Cosmopolite.typeMessage>, pins: Array.<Cosmopolite.typeMessage>,
@@ -234,6 +245,7 @@ Cosmopolite.prototype.shutdown = function() {
} }
}; };
/** /**
* Subscribe to a subject. * Subscribe to a subject.
* *
@@ -287,6 +299,7 @@ Cosmopolite.prototype.subscribe = function(subject, messages, last_id) {
}.bind(this)); }.bind(this));
}; };
/** /**
* Unsubscribe from a subject and destroy all listeners. * Unsubscribe from a subject and destroy all listeners.
* *
@@ -310,6 +323,7 @@ Cosmopolite.prototype.unsubscribe = function(subject) {
}.bind(this)); }.bind(this));
}; };
/** /**
* Post a message to the given subject, storing it and notifying all listeners. * Post a message to the given subject, storing it and notifying all listeners.
* *
@@ -336,6 +350,7 @@ Cosmopolite.prototype.sendMessage = function(subject, message) {
}.bind(this)); }.bind(this));
}; };
/** /**
* Fetch all received messages for a subject * Fetch all received messages for a subject
* *
@@ -351,6 +366,7 @@ Cosmopolite.prototype.getMessages = function(subject) {
return this.subscriptions_[subjectString].messages; return this.subscriptions_[subjectString].messages;
}; };
/** /**
* Fetch the most recent message for a subject * Fetch the most recent message for a subject
* *
@@ -368,6 +384,7 @@ Cosmopolite.prototype.getLastMessage = function(subject) {
} }
}; };
/** /**
* Fetch all current pins for a subject * Fetch all current pins for a subject
* *
@@ -383,6 +400,7 @@ Cosmopolite.prototype.getPins = function(subject) {
return this.subscriptions_[subjectString].pins; return this.subscriptions_[subjectString].pins;
}; };
/** /**
* Fetch our profile ID. * Fetch our profile ID.
* *
@@ -398,6 +416,7 @@ Cosmopolite.prototype.getProfile = function() {
}.bind(this)); }.bind(this));
}; };
/** /**
* Return our current profile ID, if known. * Return our current profile ID, if known.
* *
@@ -408,6 +427,7 @@ Cosmopolite.prototype.currentProfile = function() {
return this.profile_; return this.profile_;
}; };
/** /**
* Pin a message to the given subject, storing it and notifying all listeners. * Pin a message to the given subject, storing it and notifying all listeners.
* *
@@ -438,6 +458,7 @@ Cosmopolite.prototype.pin = function(subject, message) {
}.bind(this)); }.bind(this));
}; };
/** /**
* Unpin a message from the given subject, storing it and notifying listeners. * Unpin a message from the given subject, storing it and notifying listeners.
* *
@@ -458,6 +479,7 @@ Cosmopolite.prototype.unpin = function(id) {
}.bind(this)); }.bind(this));
}; };
/** /**
* Generate a string identifying us to be included in log messages. * Generate a string identifying us to be included in log messages.
* *
@@ -473,6 +495,7 @@ Cosmopolite.prototype.loggingPrefix_ = function() {
} }
}; };
/** /**
* Generate a v4 UUID. * Generate a v4 UUID.
* *
@@ -492,6 +515,7 @@ Cosmopolite.prototype.uuid_ = function() {
}); });
}; };
/** /**
* Canonicalize a subject name or object * Canonicalize a subject name or object
* *
@@ -537,6 +561,7 @@ Cosmopolite.prototype.onLoad_ = function() {
this.createChannel_(); this.createChannel_();
}; };
/** /**
* Callback for a message from another browser window * Callback for a message from another browser window
* *
@@ -563,6 +588,7 @@ Cosmopolite.prototype.onReceiveMessage_ = function(data) {
} }
}; };
/** /**
* Register onReceiveMessage to receive callbacks * Register onReceiveMessage to receive callbacks
* *
@@ -587,6 +613,7 @@ Cosmopolite.prototype.registerMessageHandlers_ = function() {
window.addEventListener('message', this.messageHandler_); window.addEventListener('message', this.messageHandler_);
}; };
/** /**
* Callback for a sendMessage RPC ack by the server. * Callback for a sendMessage RPC ack by the server.
* *
@@ -616,6 +643,7 @@ Cosmopolite.prototype.onMessageSent_ = function(
} }
}; };
/** /**
* Send a single RPC to the server. * Send a single RPC to the server.
* *
@@ -641,6 +669,7 @@ Cosmopolite.prototype.sendRPC_ = function(command, args, onSuccess) {
} }
}; };
/** /**
* Send one or more RPCs to the server. * Send one or more RPCs to the server.
* *
@@ -750,6 +779,7 @@ Cosmopolite.prototype.sendRPCs_ = function(commands, delay) {
xhr.send(JSON.stringify(request)); xhr.send(JSON.stringify(request));
}; };
/** /**
* Are we currently clear to put RPCs on the wire? * Are we currently clear to put RPCs on the wire?
* *
@@ -769,6 +799,7 @@ Cosmopolite.prototype.maySendRPC_ = function() {
return true; return true;
}; };
/** /**
* Handle tasks needed after reconnecting the channel * Handle tasks needed after reconnecting the channel
* *
@@ -815,6 +846,7 @@ Cosmopolite.prototype.onReconnect_ = function() {
this.sendRPCs_(rpcs); this.sendRPCs_(rpcs);
}; };
/** /**
* Send RPC to create a server -> client channel * Send RPC to create a server -> client channel
* *
@@ -840,6 +872,7 @@ Cosmopolite.prototype.createChannel_ = function() {
this.sendRPCs_(rpcs); this.sendRPCs_(rpcs);
}; };
/** /**
* Callback for channel creation on the server side * Callback for channel creation on the server side
* *
@@ -869,6 +902,7 @@ Cosmopolite.prototype.onCreateChannel_ = function(data) {
}); });
}; };
/** /**
* Callback from channel library for successful open * Callback from channel library for successful open
* *
@@ -893,6 +927,7 @@ Cosmopolite.prototype.onSocketOpen_ = function() {
this.onReconnect_(); this.onReconnect_();
}; };
/** /**
* Callback from channel library for closure; reopen. * Callback from channel library for closure; reopen.
* *
@@ -927,6 +962,7 @@ Cosmopolite.prototype.onSocketClose_ = function() {
this.createChannel_(); this.createChannel_();
}; };
/** /**
* Callback from channel library for message reception over channel * Callback from channel library for message reception over channel
* *
@@ -938,6 +974,7 @@ Cosmopolite.prototype.onSocketMessage_ = function(msg) {
/** @type {Cosmopolite.typeEvent_} */ (JSON.parse(msg.data))); /** @type {Cosmopolite.typeEvent_} */ (JSON.parse(msg.data)));
}; };
/** /**
* Callback from channel library for error on channel * Callback from channel library for error on channel
* *
@@ -951,6 +988,7 @@ Cosmopolite.prototype.onSocketError_ = function(msg) {
} }
}; };
/** /**
* Callback on receiving a 'close' event from the server * Callback on receiving a 'close' event from the server
* *
@@ -963,6 +1001,7 @@ Cosmopolite.prototype.onClose_ = function() {
} }
}; };
/** /**
* Callback on receiving a 'login' event from the server * Callback on receiving a 'login' event from the server
* *
@@ -977,6 +1016,7 @@ Cosmopolite.prototype.onLogin_ = function(e) {
} }
}; };
/** /**
* Callback on receiving a 'logout' event from the server * Callback on receiving a 'logout' event from the server
* *
@@ -990,6 +1030,7 @@ Cosmopolite.prototype.onLogout_ = function(e) {
} }
}; };
/** /**
* Callback on receiving a 'message' event from the server * Callback on receiving a 'message' event from the server
* *
@@ -1035,6 +1076,7 @@ Cosmopolite.prototype.onMessage_ = function(e) {
} }
}; };
/** /**
* Callback on receiving a 'pin' event from the server * Callback on receiving a 'pin' event from the server
* *
@@ -1068,6 +1110,7 @@ Cosmopolite.prototype.onPin_ = function(e) {
} }
}; };
/** /**
* Callback on receiving an 'unpin' event from the server * Callback on receiving an 'unpin' event from the server
* *
@@ -1105,6 +1148,7 @@ Cosmopolite.prototype.onUnpin_ = function(e) {
} }
}; };
/** /**
* Callback for Cosmopolite event (received via channel or pseudo-channel) * Callback for Cosmopolite event (received via channel or pseudo-channel)
* *
@@ -1149,6 +1193,7 @@ Cosmopolite.prototype.onServerEvent_ = function(e) {
} }
}; };
/** @type {function(new:Cosmopolite, /** @type {function(new:Cosmopolite,
?Cosmopolite.typeCallbacks=, ?Cosmopolite.typeCallbacks=,
?string=, ?string=,

View File

@@ -13,4 +13,4 @@ curl \
http://closure-compiler.appspot.com/compile http://closure-compiler.appspot.com/compile
echo echo
gjslint --disable=0121 cosmopolite.js gjslint --strict --disable=0121,0233 cosmopolite.js