Browse Source

feat(ChatRoom): join() returns a Promise

dev1
paweldomas 7 years ago
parent
commit
e7bbf4f371
1 changed files with 10 additions and 2 deletions
  1. 10
    2
      modules/xmpp/ChatRoom.js

+ 10
- 2
modules/xmpp/ChatRoom.js View File

@@ -233,12 +233,20 @@ export default class ChatRoom extends Listenable {
233 233
     }
234 234
 
235 235
     /**
236
-     *
236
+     * Joins the chat room.
237 237
      * @param password
238
+     * @returns {Promise} - resolved when join completes. At the time of this
239
+     * writing it's never rejected.
238 240
      */
239 241
     join(password) {
240 242
         this.password = password;
241
-        this.moderator.allocateConferenceFocus(() => this.sendPresence(true));
243
+
244
+        return new Promise(resolve => {
245
+            this.moderator.allocateConferenceFocus(() => {
246
+                this.sendPresence(true);
247
+                resolve();
248
+            });
249
+        });
242 250
     }
243 251
 
244 252
     /**

Loading…
Cancel
Save