浏览代码

Adds uiLoaded event in iframe API, fired when all resources are loaded.

master
damencho 7 年前
父节点
当前提交
2478176f23
共有 2 个文件被更改,包括 20 次插入5 次删除
  1. 1
    0
      doc/api.md
  2. 19
    5
      modules/API/external/external_api.js

+ 1
- 0
doc/api.md 查看文件

27
     * **interfaceConfigOverwrite**: (optional) JS object with overrides for options defined in [interface_config.js].
27
     * **interfaceConfigOverwrite**: (optional) JS object with overrides for options defined in [interface_config.js].
28
     * **noSSL**: (optional, defaults to true) Boolean indicating if the server should be contacted using HTTP or HTTPS.
28
     * **noSSL**: (optional, defaults to true) Boolean indicating if the server should be contacted using HTTP or HTTPS.
29
     * **jwt**: (optional) [JWT](https://jwt.io/) token.
29
     * **jwt**: (optional) [JWT](https://jwt.io/) token.
30
+    * **onload**: (optional) handler for the iframe onload event.
30
 
31
 
31
 Example:
32
 Example:
32
 
33
 

+ 19
- 5
modules/API/external/external_api.js 查看文件

123
             configOverwrite,
123
             configOverwrite,
124
             interfaceConfigOverwrite,
124
             interfaceConfigOverwrite,
125
             noSSL,
125
             noSSL,
126
-            jwt
126
+            jwt,
127
+            onload
127
         ] = args;
128
         ] = args;
128
 
129
 
129
         return {
130
         return {
134
             configOverwrite,
135
             configOverwrite,
135
             interfaceConfigOverwrite,
136
             interfaceConfigOverwrite,
136
             noSSL,
137
             noSSL,
137
-            jwt
138
+            jwt,
139
+            onload
138
         };
140
         };
139
     case 'object': // new arguments format
141
     case 'object': // new arguments format
140
         return args[0];
142
         return args[0];
196
      * used.
198
      * used.
197
      * @param {string} [options.jwt] - The JWT token if needed by jitsi-meet for
199
      * @param {string} [options.jwt] - The JWT token if needed by jitsi-meet for
198
      * authentication.
200
      * authentication.
201
+     * @param {string} [options.onload] - The onload function that will listen
202
+     * for iframe onload event.
199
      */
203
      */
200
     constructor(domain, ...args) {
204
     constructor(domain, ...args) {
201
         super();
205
         super();
207
             configOverwrite = {},
211
             configOverwrite = {},
208
             interfaceConfigOverwrite = {},
212
             interfaceConfigOverwrite = {},
209
             noSSL = false,
213
             noSSL = false,
210
-            jwt = undefined
214
+            jwt = undefined,
215
+            onload = undefined
211
         } = parseArguments(args);
216
         } = parseArguments(args);
212
 
217
 
213
         this._parentNode = parentNode;
218
         this._parentNode = parentNode;
218
             noSSL,
223
             noSSL,
219
             roomName
224
             roomName
220
         });
225
         });
221
-        this._createIFrame(height, width);
226
+        this._createIFrame(height, width, onload);
222
         this._transport = new Transport({
227
         this._transport = new Transport({
223
             backend: new PostMessageTransportBackend({
228
             backend: new PostMessageTransportBackend({
224
                 postisOptions: {
229
                 postisOptions: {
243
      * parseSizeParam for format details.
248
      * parseSizeParam for format details.
244
      * @param {number|string} width - The with of the iframe. Check
249
      * @param {number|string} width - The with of the iframe. Check
245
      * parseSizeParam for format details.
250
      * parseSizeParam for format details.
251
+     * @param {Function} onload - The function that will listen
252
+     * for onload event.
246
      * @returns {void}
253
      * @returns {void}
247
      *
254
      *
248
      * @private
255
      * @private
249
      */
256
      */
250
-    _createIFrame(height, width) {
257
+    _createIFrame(height, width, onload) {
251
         const frameName = `jitsiConferenceFrame${id}`;
258
         const frameName = `jitsiConferenceFrame${id}`;
252
 
259
 
253
         this._frame = document.createElement('iframe');
260
         this._frame = document.createElement('iframe');
258
         this._setSize(height, width);
265
         this._setSize(height, width);
259
         this._frame.setAttribute('allowFullScreen', 'true');
266
         this._frame.setAttribute('allowFullScreen', 'true');
260
         this._frame.style.border = 0;
267
         this._frame.style.border = 0;
268
+
269
+        if (onload) {
270
+            // waits for iframe resources to load
271
+            // and fires event when it is done
272
+            this._frame.onload = onload;
273
+        }
274
+
261
         this._frame = this._parentNode.appendChild(this._frame);
275
         this._frame = this._parentNode.appendChild(this._frame);
262
     }
276
     }
263
 
277
 

正在加载...
取消
保存