浏览代码

feat(external-api) Forward non participant message to iframe (#13440)

* Forward non-participant-message-received to iFrame API

* Updated comment

* Fix lint errors
factor2
garysmith058 2 年前
父节点
当前提交
277ca23c52
没有帐户链接到提交者的电子邮件
共有 3 个文件被更改,包括 22 次插入1 次删除
  1. 4
    1
      conference.js
  2. 17
    0
      modules/API/API.js
  3. 1
    0
      modules/API/external/external_api.js

+ 4
- 1
conference.js 查看文件

@@ -2029,7 +2029,10 @@ export default {
2029 2029
 
2030 2030
         room.on(
2031 2031
             JitsiConferenceEvents.NON_PARTICIPANT_MESSAGE_RECEIVED,
2032
-            (...args) => APP.store.dispatch(nonParticipantMessageReceived(...args)));
2032
+            (...args) => {
2033
+                APP.store.dispatch(nonParticipantMessageReceived(...args));
2034
+                APP.API.notifyNonParticipantMessageReceived(...args);
2035
+            });
2033 2036
 
2034 2037
         room.on(
2035 2038
             JitsiConferenceEvents.LOCK_STATE_CHANGED,

+ 17
- 0
modules/API/API.js 查看文件

@@ -2027,6 +2027,23 @@ class API {
2027 2027
         });
2028 2028
     }
2029 2029
 
2030
+    /**
2031
+     * Notify external application (if API is enabled) if non participant message
2032
+     * is received.
2033
+     *
2034
+     * @param {string} id - The resource id of the sender.
2035
+     * @param {Object} json - The json carried by the message.
2036
+     * @returns {void}
2037
+     */
2038
+    notifyNonParticipantMessageReceived(id, json) {
2039
+        this._sendEvent({
2040
+            name: 'non-participant-message-received',
2041
+            id,
2042
+            message: json
2043
+        });
2044
+    }
2045
+
2046
+
2030 2047
     /**
2031 2048
      * Notify the external application (if API is enabled) if the connection type changed.
2032 2049
      *

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

@@ -128,6 +128,7 @@ const events = {
128 128
     'mouse-enter': 'mouseEnter',
129 129
     'mouse-leave': 'mouseLeave',
130 130
     'mouse-move': 'mouseMove',
131
+    'non-participant-message-received': 'nonParticipantMessageReceived',
131 132
     'notification-triggered': 'notificationTriggered',
132 133
     'outgoing-message': 'outgoingMessage',
133 134
     'p2p-status-changed': 'p2pStatusChanged',

正在加载...
取消
保存