Merge pull request #15394 from ctrlaltdavid/M22223

Case 22223: Messages JSDoc update
This commit is contained in:
Shannon Romano 2019-04-26 10:40:10 -07:00 committed by GitHub
commit 4947f14eb7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -24,11 +24,11 @@
#include "ReceivedMessage.h"
/**jsdoc
* <p>The Messages API enables text and data to be sent between scripts over named "channels". A channel can have an arbitrary
* name to help separate messaging between different sets of scripts.</p>
* <p>The <code>Messages</code> API enables text and data to be sent between scripts over named "channels". A channel can have
* an arbitrary name to help separate messaging between different sets of scripts.</p>
*
* <p><strong>Note:</strong> If you want to call a function in another script, you should use one of the following rather than
* sending a message:</p>
* <p><strong>Note:</strong> To call a function in another script, you should use one of the following rather than sending a
* message:</p>
* <ul>
* <li>{@link Entities.callEntityClientMethod}</li>
* <li>{@link Entities.callEntityMethod}</li>
@ -52,7 +52,7 @@ public:
void startThread();
/**jsdoc
* Send a text message on a channel.
* Sends a text message on a channel.
* @function Messages.sendMessage
* @param {string} channel - The channel to send the message on.
* @param {string} message - The message to send.
@ -90,9 +90,8 @@ public:
Q_INVOKABLE void sendMessage(QString channel, QString message, bool localOnly = false);
/**jsdoc
* Send a text message locally on a channel.
* This is the same as calling {@link Messages.sendMessage|sendMessage} with <code>localOnly</code> set to
* <code>true</code>.
* Sends a text message locally on a channel.
* This is the same as calling {@link Messages.sendMessage|sendMessage} with <code>localOnly == true</code>.
* @function Messages.sendLocalMessage
* @param {string} channel - The channel to send the message on.
* @param {string} message - The message to send.
@ -100,10 +99,10 @@ public:
Q_INVOKABLE void sendLocalMessage(QString channel, QString message);
/**jsdoc
* Send a data message on a channel.
* Sends a data message on a channel.
* @function Messages.sendData
* @param {string} channel - The channel to send the data on.
* @param {object} data - The data to send. The data is handled as a byte stream, for example as may be provided via a
* @param {object} data - The data to send. The data is handled as a byte stream, for example, as may be provided via a
* JavaScript <code>Int8Array</code> object.
* @param {boolean} [localOnly=false] - If <code>false</code> then the message is sent to all Interface, client entity,
* server entity, and assignment client scripts in the domain.<br />
@ -147,16 +146,16 @@ public:
Q_INVOKABLE void sendData(QString channel, QByteArray data, bool localOnly = false);
/**jsdoc
* Subscribe the scripting environment &mdash; Interface, the entity script server, or assignment client instance &mdash;
* to receive messages on a specific channel. Note that, for example, if there are two Interface scripts that subscribe to
* different channels, both scripts will receive messages on both channels.
* Subscribes the scripting environment &mdash; Interface, the entity script server, or assignment client instance &mdash;
* to receive messages on a specific channel.This means, for example, that if there are two Interface scripts that
* subscribe to different channels, both scripts will receive messages on both channels.
* @function Messages.subscribe
* @param {string} channel - The channel to subscribe to.
*/
Q_INVOKABLE void subscribe(QString channel);
/**jsdoc
* Unsubscribe the scripting environment from receiving messages on a specific channel.
* Unsubscribes the scripting environment from receiving messages on a specific channel.
* @function Messages.unsubscribe
* @param {string} channel - The channel to unsubscribe from.
*/
@ -170,15 +169,15 @@ public:
signals:
/**jsdoc
* Triggered when the a text message is received.
* Triggered when a text message is received.
* @function Messages.messageReceived
* @param {string} channel - The channel that the message was sent on. You can use this to filter out messages not relevant
* @param {string} channel - The channel that the message was sent on. This can be used to filter out messages not relevant
* to your script.
* @param {string} message - The message received.
* @param {Uuid} senderID - The UUID of the sender: the user's session UUID if sent by an Interface or client entity
* script, the UUID of the entity script server if sent by a server entity script, or the UUID of the assignment client
* instance if sent by an assignment client script.
* @param {boolean} localOnly - <code>true</code> if the message was sent with <code>localOnly = true</code>.
* @param {boolean} localOnly - <code>true</code> if the message was sent with <code>localOnly == true</code>.
* @returns {Signal}
*/
void messageReceived(QString channel, QString message, QUuid senderUUID, bool localOnly);
@ -186,15 +185,14 @@ signals:
/**jsdoc
* Triggered when a data message is received.
* @function Messages.dataReceived
* @param {string} channel - The channel that the message was sent on. You can use this to filter out messages not relevant
* @param {string} channel - The channel that the message was sent on. This can be used to filter out messages not relevant
* to your script.
* @param {object} data - The data received. The data is handled as a byte stream, for example as may be used by a
* @param {object} data - The data received. The data is handled as a byte stream, for example, as may be used by a
* JavaScript <code>Int8Array</code> object.
* @param {Uuid} senderID - The UUID of the sender: the user's session UUID if sent by an Interface or client entity
* script, the UUID of the entity script server if sent by a server entity script, or the UUID of the assignment client
* script, the UUID of the entity script server if sent by a server entity script, or the UUID of the assignment client
* instance if sent by an assignment client script.
* @param {boolean} localOnly - <code>true</code> if the message was sent with <code>localOnly = true</code>.
* @param {boolean} localOnly - <code>true</code> if the message was sent with <code>localOnly == true</code>.
* @returns {Signal}
*/
void dataReceived(QString channel, QByteArray data, QUuid senderUUID, bool localOnly);