Whitespace for strict linting.
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Java-compatible hash calculation
|
||||
*
|
||||
@@ -36,6 +37,7 @@ String.prototype.hashCode = function() {
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @param {?Cosmopolite.typeCallbacks=} callbacks
|
||||
@@ -133,6 +135,7 @@ var Cosmopolite = function(callbacks, urlPrefix, namespace) {
|
||||
}, this);
|
||||
};
|
||||
|
||||
|
||||
/** @typedef {{onConnect: (function()|undefined),
|
||||
onDisconnect: (function()|undefined),
|
||||
onLogin: (function(string, string)|undefined),
|
||||
@@ -142,21 +145,25 @@ var Cosmopolite = function(callbacks, urlPrefix, namespace) {
|
||||
onUnpin: (function(Cosmopolite.typeMessage)|undefined)}} */
|
||||
Cosmopolite.typeCallbacks;
|
||||
|
||||
|
||||
/**
|
||||
* @typedef {{event_type: string}}
|
||||
* @private
|
||||
*/
|
||||
Cosmopolite.typeEvent_;
|
||||
|
||||
|
||||
/** @typedef {{event_type: string,
|
||||
profile: string,
|
||||
google_user: string}} */
|
||||
Cosmopolite.typeLogin;
|
||||
|
||||
|
||||
/** @typedef {{event_type: string,
|
||||
profile: string}} */
|
||||
Cosmopolite.typeLogout;
|
||||
|
||||
|
||||
/** @typedef {{event_type: string,
|
||||
id: number,
|
||||
created: number,
|
||||
@@ -165,6 +172,7 @@ Cosmopolite.typeLogout;
|
||||
message: *}} */
|
||||
Cosmopolite.typeMessage;
|
||||
|
||||
|
||||
/**
|
||||
* @typedef {{command: string,
|
||||
arguments: Object,
|
||||
@@ -173,14 +181,17 @@ Cosmopolite.typeMessage;
|
||||
*/
|
||||
Cosmopolite.typeRPC_;
|
||||
|
||||
|
||||
/** @typedef {{name: string,
|
||||
readable_only_by: (string|undefined),
|
||||
writable_only_by: (string|undefined)}} */
|
||||
Cosmopolite.typeSubject;
|
||||
|
||||
|
||||
/** @typedef {(Cosmopolite.typeSubject|string|number)} */
|
||||
Cosmopolite.typeSubjectLoose;
|
||||
|
||||
|
||||
/**
|
||||
* @typedef {{messages: Array.<Cosmopolite.typeMessage>,
|
||||
pins: Array.<Cosmopolite.typeMessage>,
|
||||
@@ -234,6 +245,7 @@ Cosmopolite.prototype.shutdown = function() {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Subscribe to a subject.
|
||||
*
|
||||
@@ -287,6 +299,7 @@ Cosmopolite.prototype.subscribe = function(subject, messages, last_id) {
|
||||
}.bind(this));
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Unsubscribe from a subject and destroy all listeners.
|
||||
*
|
||||
@@ -310,6 +323,7 @@ Cosmopolite.prototype.unsubscribe = function(subject) {
|
||||
}.bind(this));
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* 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));
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Fetch all received messages for a subject
|
||||
*
|
||||
@@ -351,6 +366,7 @@ Cosmopolite.prototype.getMessages = function(subject) {
|
||||
return this.subscriptions_[subjectString].messages;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Fetch the most recent message for a subject
|
||||
*
|
||||
@@ -368,6 +384,7 @@ Cosmopolite.prototype.getLastMessage = function(subject) {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Fetch all current pins for a subject
|
||||
*
|
||||
@@ -383,6 +400,7 @@ Cosmopolite.prototype.getPins = function(subject) {
|
||||
return this.subscriptions_[subjectString].pins;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Fetch our profile ID.
|
||||
*
|
||||
@@ -398,6 +416,7 @@ Cosmopolite.prototype.getProfile = function() {
|
||||
}.bind(this));
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Return our current profile ID, if known.
|
||||
*
|
||||
@@ -408,6 +427,7 @@ Cosmopolite.prototype.currentProfile = function() {
|
||||
return this.profile_;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* 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));
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Unpin a message from the given subject, storing it and notifying listeners.
|
||||
*
|
||||
@@ -458,6 +479,7 @@ Cosmopolite.prototype.unpin = function(id) {
|
||||
}.bind(this));
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Generate a string identifying us to be included in log messages.
|
||||
*
|
||||
@@ -473,6 +495,7 @@ Cosmopolite.prototype.loggingPrefix_ = function() {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Generate a v4 UUID.
|
||||
*
|
||||
@@ -492,6 +515,7 @@ Cosmopolite.prototype.uuid_ = function() {
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Canonicalize a subject name or object
|
||||
*
|
||||
@@ -537,6 +561,7 @@ Cosmopolite.prototype.onLoad_ = function() {
|
||||
this.createChannel_();
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Callback for a message from another browser window
|
||||
*
|
||||
@@ -563,6 +588,7 @@ Cosmopolite.prototype.onReceiveMessage_ = function(data) {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Register onReceiveMessage to receive callbacks
|
||||
*
|
||||
@@ -587,6 +613,7 @@ Cosmopolite.prototype.registerMessageHandlers_ = function() {
|
||||
window.addEventListener('message', this.messageHandler_);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Callback for a sendMessage RPC ack by the server.
|
||||
*
|
||||
@@ -616,6 +643,7 @@ Cosmopolite.prototype.onMessageSent_ = function(
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
@@ -750,6 +779,7 @@ Cosmopolite.prototype.sendRPCs_ = function(commands, delay) {
|
||||
xhr.send(JSON.stringify(request));
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Are we currently clear to put RPCs on the wire?
|
||||
*
|
||||
@@ -769,6 +799,7 @@ Cosmopolite.prototype.maySendRPC_ = function() {
|
||||
return true;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Handle tasks needed after reconnecting the channel
|
||||
*
|
||||
@@ -815,6 +846,7 @@ Cosmopolite.prototype.onReconnect_ = function() {
|
||||
this.sendRPCs_(rpcs);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Send RPC to create a server -> client channel
|
||||
*
|
||||
@@ -840,6 +872,7 @@ Cosmopolite.prototype.createChannel_ = function() {
|
||||
this.sendRPCs_(rpcs);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Callback for channel creation on the server side
|
||||
*
|
||||
@@ -869,6 +902,7 @@ Cosmopolite.prototype.onCreateChannel_ = function(data) {
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Callback from channel library for successful open
|
||||
*
|
||||
@@ -893,6 +927,7 @@ Cosmopolite.prototype.onSocketOpen_ = function() {
|
||||
this.onReconnect_();
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Callback from channel library for closure; reopen.
|
||||
*
|
||||
@@ -927,6 +962,7 @@ Cosmopolite.prototype.onSocketClose_ = function() {
|
||||
this.createChannel_();
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* 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)));
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
@@ -963,6 +1001,7 @@ Cosmopolite.prototype.onClose_ = function() {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
@@ -990,6 +1030,7 @@ Cosmopolite.prototype.onLogout_ = function(e) {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
@@ -1068,6 +1110,7 @@ Cosmopolite.prototype.onPin_ = function(e) {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* 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)
|
||||
*
|
||||
@@ -1149,6 +1193,7 @@ Cosmopolite.prototype.onServerEvent_ = function(e) {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/** @type {function(new:Cosmopolite,
|
||||
?Cosmopolite.typeCallbacks=,
|
||||
?string=,
|
||||
|
||||
@@ -13,4 +13,4 @@ curl \
|
||||
http://closure-compiler.appspot.com/compile
|
||||
echo
|
||||
|
||||
gjslint --disable=0121 cosmopolite.js
|
||||
gjslint --strict --disable=0121,0233 cosmopolite.js
|
||||
|
||||
Reference in New Issue
Block a user