瀏覽代碼

Add JSDoc

master
Ilya Daynatovich 8 年之前
父節點
當前提交
5e8c5b3ce4
共有 2 個檔案被更改,包括 46 行新增1 行删除
  1. 40
    0
      modules/UI/invite/RequirePasswordDialog.js
  2. 6
    1
      modules/UI/invite/RoomLocker.js

+ 40
- 0
modules/UI/invite/RequirePasswordDialog.js 查看文件

@@ -17,11 +17,20 @@ export default class RequirePasswordDialog {
17 17
         this.isOpened = false;
18 18
     }
19 19
 
20
+    /**
21
+     * Registering dialog listeners
22
+     * @private
23
+     */
20 24
     _registerListeners() {
21 25
         let el = document.getElementById(this.inputId);
22 26
         el.addEventListener('keypress', this._hideError.bind(this));
23 27
     }
24 28
 
29
+    /**
30
+     * Helper method returning dialog body
31
+     * @returns {string}
32
+     * @private
33
+     */
25 34
     _getBodyMessage() {
26 35
         return (
27 36
             `<div class="input-control">
@@ -37,6 +46,10 @@ export default class RequirePasswordDialog {
37 46
         );
38 47
     }
39 48
 
49
+    /**
50
+     * Asking for a password
51
+     * @returns {Promise}
52
+     */
40 53
     askForPassword() {
41 54
         if (!this.isOpened) {
42 55
             return this.open();
@@ -49,6 +62,10 @@ export default class RequirePasswordDialog {
49 62
         });
50 63
     }
51 64
 
65
+    /**
66
+     * Opens the dialog
67
+     * @returns {Promise}
68
+     */
52 69
     open() {
53 70
         let { titleKey } = this;
54 71
         let msgString = this._getBodyMessage();
@@ -73,6 +90,14 @@ export default class RequirePasswordDialog {
73 90
         });
74 91
     }
75 92
 
93
+    /**
94
+     * Submit dialog callback
95
+     * @param e - event
96
+     * @param v - value
97
+     * @param m - message
98
+     * @param f - form
99
+     * @private
100
+     */
76 101
     _submitFunction(e, v, m, f) {
77 102
         e.preventDefault();
78 103
 
@@ -83,23 +108,38 @@ export default class RequirePasswordDialog {
83 108
         }
84 109
     }
85 110
 
111
+    /**
112
+     * Close dialog callback
113
+     * @private
114
+     */
86 115
     _closeFunction() {
87 116
         this._hideError();
88 117
         this.close();
89 118
     }
90 119
 
120
+    /**
121
+     * Method showing error hint
122
+     * @private
123
+     */
91 124
     _showError() {
92 125
         let className = this.inputErrorClass;
93 126
         document.getElementById(this.errorId).classList.remove('hide');
94 127
         document.getElementById(this.inputId).classList.add(className);
95 128
     }
96 129
 
130
+    /**
131
+     * Method hiding error hint
132
+     * @private
133
+     */
97 134
     _hideError() {
98 135
         let className = this.inputErrorClass;
99 136
         document.getElementById(this.errorId).classList.add('hide');
100 137
         document.getElementById(this.inputId).classList.remove(className);
101 138
     }
102 139
 
140
+    /**
141
+     * Close the dialog
142
+     */
103 143
     close() {
104 144
         APP.UI.messageHandler.closeDialog();
105 145
         this.isOpened = false;

+ 6
- 1
modules/UI/invite/RoomLocker.js 查看文件

@@ -118,8 +118,13 @@ export default function createRoomLocker (room) {
118 118
             );
119 119
         },
120 120
 
121
+        /**
122
+         * Hides require password dialog
123
+         */
121 124
         hideRequirePasswordDialog() {
122
-            requirePasswordDialog.close();
125
+            if (requirePasswordDialog.isOpened) {
126
+                requirePasswordDialog.close();
127
+            }
123 128
         }
124 129
     };
125 130
 }

Loading…
取消
儲存