mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-24 08:23:12 +09:00
Fix JSDoc issues
Fix missing documentation for parameters and return types, incorect config and errors in type definitions.
This commit is contained in:
1 parent
3dba92a03d
commit
703fda43ad
20 files changed
+193
-52
No files matched your search
+12
-2
@@ -94,7 +94,9 @@ class WebSocketBaseConnector extends events.EventEmitter {
|
||||
/**
|
||||
* Send a message over the socket
|
||||
*
|
||||
* @returns the sequence number of the message sent
|
||||
* @param {string} type - Message type to send.
|
||||
* @param {Object} data - Data to send with message.
|
||||
* @returns {number} the sequence number of the message sent
|
||||
*/
|
||||
send(type, data) {
|
||||
if (!["handshake", "connected", "closing"].includes(this._state)) {
|
||||
@@ -181,6 +183,9 @@ class WebSocketClientConnector extends WebSocketBaseConnector {
|
||||
*
|
||||
* Used in the register function in order to send the register handshake
|
||||
* message over the WebSocket.
|
||||
*
|
||||
* @param {string} type - Message type to send.
|
||||
* @param {Object} data - Data to send with message.
|
||||
*/
|
||||
sendHandshake(type, data) {
|
||||
this._check(["handshake"]);
|
||||
@@ -191,6 +196,9 @@ class WebSocketClientConnector extends WebSocketBaseConnector {
|
||||
* Close the connection with the given reason.
|
||||
*
|
||||
* Sends a close frame and disconnects the connector.
|
||||
*
|
||||
* @param {number} code - WebSocket close code.
|
||||
* @param {string} reason - WebSocket close reason.
|
||||
*/
|
||||
async close(code, reason) {
|
||||
if (this._state === "new") {
|
||||
@@ -449,7 +457,9 @@ class VirtualConnector extends events.EventEmitter {
|
||||
/**
|
||||
* Send a message to the other end of the connector
|
||||
*
|
||||
* @returns the sequence number of the message sent
|
||||
* @param {string} type - Message type to send.
|
||||
* @param {Object} data - Data to send with message.
|
||||
* @returns {number} the sequence number of the message sent
|
||||
*/
|
||||
send(type, data) {
|
||||
this.other.emit("message", { seq: this._seq, type, data });
|
||||
|
||||
@@ -72,6 +72,7 @@ class Link {
|
||||
* Validates and invokes the handler and/or waiters for a message that has
|
||||
* been received. An unhandled message is considered to be an error.
|
||||
*
|
||||
* @param {Object} message - Message to process.
|
||||
* @throws {module:lib/errors.InvalidMessage}
|
||||
* if validation failed, is missing, the message is invalid, or no
|
||||
* handlers/waiters were invoked to handle the message.
|
||||
@@ -102,6 +103,7 @@ class Link {
|
||||
/**
|
||||
* Invoke the handler for this message if it exists
|
||||
*
|
||||
* @param {Object} message - Message to invoke handlers on.
|
||||
* @returns {Boolean} true if a handler was invoked.
|
||||
*/
|
||||
_processHandler(message) {
|
||||
@@ -117,6 +119,7 @@ class Link {
|
||||
/**
|
||||
* Invokes the waiters for this message if any
|
||||
*
|
||||
* @param {Object} message - Message to invoke waiters on.
|
||||
* @returns {Boolean} true if a waiter was triggered.
|
||||
*/
|
||||
_processWaiters(message) {
|
||||
@@ -196,6 +199,9 @@ class Link {
|
||||
* as any properties specified in data. For example specifying { foo:
|
||||
* 21 } as the data will cause it to wait until a message with the right
|
||||
* type and a foo property value of 21 in the data payload.
|
||||
*
|
||||
* @param {string} type - Message type to wait for.
|
||||
* @param {Object} data - Properties to match in the message data.
|
||||
*/
|
||||
async waitFor(type, data) {
|
||||
if (!this._validators.has(type)) {
|
||||
|
||||
@@ -208,6 +208,8 @@ class Request extends Message {
|
||||
* Sends the given data over the link as the request payload and waits
|
||||
* for the response.
|
||||
*
|
||||
* @param {module:lib/link.Link} link - Link to send request over.
|
||||
* @param {Object} data - Data to send with the request.
|
||||
* @returns {object} response data
|
||||
*/
|
||||
async send(link, data = {}) {
|
||||
@@ -726,6 +728,9 @@ class Event extends Message {
|
||||
* Send event over the given link
|
||||
*
|
||||
* Sends the given event data over the link.
|
||||
*
|
||||
* @param {module:lib/link.Link} link - Link to send event over.
|
||||
* @param {Object} data - Data to send with the event.
|
||||
*/
|
||||
send(link, data = {}) {
|
||||
if (!this._eventValidator({ seq: 0, type: this.eventType, data })) {
|
||||
@@ -843,6 +848,7 @@ messages.playerEvent = new Event({
|
||||
* link instance as the concatenation of the name of the message, the
|
||||
* name of message class, and 'Handler'.
|
||||
*
|
||||
* @param {module:lib/link.Link} link - Link to attach messages to.
|
||||
* @memberof module:lib/link
|
||||
*/
|
||||
function attachAllMessages(link) {
|
||||
|
||||
Reference in new issue
Block a user