Add JSDoc example

This commit is contained in:
JC Brand 2021-11-17 09:42:34 +01:00
parent 1ee75b78b7
commit e347621dc8
3 changed files with 17 additions and 2 deletions

View File

@ -19,6 +19,21 @@ export default {
* @param { String } users[].jid - The JID of the user whose affiliation will change * @param { String } users[].jid - The JID of the user whose affiliation will change
* @param { ('outcast'|'member'|'admin'|'owner') } users[].affiliation - The new affiliation for this user * @param { ('outcast'|'member'|'admin'|'owner') } users[].affiliation - The new affiliation for this user
* @param { String } [users[].reason] - An optional reason for the affiliation change * @param { String } [users[].reason] - An optional reason for the affiliation change
* @returns { Promise }
*
* @example
* api.rooms.affiliations.set(
* [
* 'muc1@muc.example.org',
* 'muc2@muc.example.org'
* ], [
* {
* 'jid': 'user@example.org',
* 'affiliation': 'member',
* 'reason': "You're one of us now!"
* }
* ]
* )
*/ */
set (muc_jids, users) { set (muc_jids, users) {
users = !Array.isArray(users) ? [users] : users; users = !Array.isArray(users) ? [users] : users;

View File

@ -70,7 +70,7 @@ export default {
* @returns {Promise} Promise which resolves with the Model representing the chat. * @returns {Promise} Promise which resolves with the Model representing the chat.
* *
* @example * @example
* this.api.rooms.open('group@muc.example.com') * api.rooms.open('group@muc.example.com')
* *
* @example * @example
* // To return an array of rooms, provide an array of room JIDs: * // To return an array of rooms, provide an array of room JIDs:

View File

@ -7,7 +7,7 @@ import { html } from "lit";
import { parseMessageForCommands } from 'plugins/chatview/utils.js'; import { parseMessageForCommands } from 'plugins/chatview/utils.js';
import { setAffiliation } from '@converse/headless/plugins/muc/affiliations/utils.js'; import { setAffiliation } from '@converse/headless/plugins/muc/affiliations/utils.js';
const { Strophe, $pres, $iq, sizzle, u } = converse.env; const { Strophe, $iq, sizzle, u } = converse.env;
const COMMAND_TO_AFFILIATION = { const COMMAND_TO_AFFILIATION = {
'admin': 'admin', 'admin': 'admin',