Browse Source

Add JSDoc example

JC Brand 3 years ago
parent
commit
e347621dc8

+ 15 - 0
src/headless/plugins/muc/affiliations/api.js

@@ -19,6 +19,21 @@ export default {
          * @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 { 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) {
             users = !Array.isArray(users) ? [users] : users;

+ 1 - 1
src/headless/plugins/muc/api.js

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

+ 1 - 1
src/plugins/muc-views/utils.js

@@ -7,7 +7,7 @@ import { html } from "lit";
 import { parseMessageForCommands } from 'plugins/chatview/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 = {
     'admin': 'admin',