浏览代码

Reduce the dependencies of the Web ExternalAPI

We broke external_api.min.js by importing react/features/util which
imported react/features/base/lib-jitsi-meet.

1. To reduce the risks of such a breakage until we add
   external_api.min.js to the torture tests, import as little as
   possible in modules/API/external/external_api.js.
2. Use the global JitsiMeetJS on Web in react/features/base/util.
master
Lyubo Marinov 7 年前
父节点
当前提交
15ab7a292c
共有 2 个文件被更改,包括 7 次插入5 次删除
  1. 1
    1
      modules/API/external/external_api.js
  2. 6
    4
      react/features/base/util/loadScript.web.js

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

1
 import EventEmitter from 'events';
1
 import EventEmitter from 'events';
2
 
2
 
3
-import { urlObjectToString } from '../../../react/features/base/util';
3
+import { urlObjectToString } from '../../../react/features/base/util/uri.js';
4
 import {
4
 import {
5
     PostMessageTransportBackend,
5
     PostMessageTransportBackend,
6
     Transport
6
     Transport

+ 6
- 4
react/features/base/util/loadScript.web.js 查看文件

1
-import JitsiMeetJS from '../lib-jitsi-meet';
1
+/* @flow */
2
+
3
+declare var JitsiMeetJS: Object;
2
 
4
 
3
 /**
5
 /**
4
  * Loads a script from a specific URL. The script will be interpreted upon load.
6
  * Loads a script from a specific URL. The script will be interpreted upon load.
7
  * @returns {Promise} Resolved with no arguments when the script is loaded and
9
  * @returns {Promise} Resolved with no arguments when the script is loaded and
8
  * rejected with the error from JitsiMeetJS.ScriptUtil.loadScript method.
10
  * rejected with the error from JitsiMeetJS.ScriptUtil.loadScript method.
9
  */
11
  */
10
-export function loadScript(url) {
12
+export function loadScript(url: string) {
11
     return new Promise((resolve, reject) =>
13
     return new Promise((resolve, reject) =>
12
         JitsiMeetJS.util.ScriptUtil.loadScript(
14
         JitsiMeetJS.util.ScriptUtil.loadScript(
13
             url,
15
             url,
14
             /* async */ true,
16
             /* async */ true,
15
             /* prepend */ false,
17
             /* prepend */ false,
16
             /* relativeURL */ false,
18
             /* relativeURL */ false,
17
-            /* loadCallback */ () => resolve(),
18
-            /* errorCallback */ error => reject(error)));
19
+            /* loadCallback */ resolve,
20
+            /* errorCallback */ reject));
19
 }
21
 }

正在加载...
取消
保存