Coding style
For lack of a better word/phrase, I'm calling all changes coding style. I'm targeting readability through naming and syntax.
This commit is contained in:
parent
3e055c1201
commit
e9dc9c47a9
|
@ -8,9 +8,9 @@ node_modules/
|
||||||
# The following are checked by ESLint with the maximum configuration which
|
# The following are checked by ESLint with the maximum configuration which
|
||||||
# supersedes JSHint.
|
# supersedes JSHint.
|
||||||
flow-typed/
|
flow-typed/
|
||||||
react/
|
|
||||||
modules/API/
|
modules/API/
|
||||||
modules/transport/
|
modules/transport/
|
||||||
|
react/
|
||||||
|
|
||||||
# The following are checked by ESLint with the minimum configuration which does
|
# The following are checked by ESLint with the minimum configuration which does
|
||||||
# not supersede JSHint but take advantage of advanced language features such as
|
# not supersede JSHint but take advantage of advanced language features such as
|
||||||
|
|
|
@ -37,9 +37,7 @@ function initCommands() {
|
||||||
'email': APP.conference.changeLocalEmail,
|
'email': APP.conference.changeLocalEmail,
|
||||||
'avatar-url': APP.conference.changeLocalAvatarUrl
|
'avatar-url': APP.conference.changeLocalAvatarUrl
|
||||||
};
|
};
|
||||||
transport.on('event', event => {
|
transport.on('event', ({ data, name }) => {
|
||||||
const { name, data } = event;
|
|
||||||
|
|
||||||
if (name && commands[name]) {
|
if (name && commands[name]) {
|
||||||
commands[name](...data);
|
commands[name](...data);
|
||||||
|
|
||||||
|
@ -101,15 +99,18 @@ class API {
|
||||||
* module.
|
* module.
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
init(options = {}) {
|
init({ forceEnable } = {}) {
|
||||||
if (!shouldBeEnabled() && !options.forceEnable) {
|
if (!shouldBeEnabled() && !forceEnable) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Current status (enabled/disabled) of API.
|
* Current status (enabled/disabled) of API.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @type {boolean}
|
||||||
*/
|
*/
|
||||||
this.enabled = true;
|
this._enabled = true;
|
||||||
|
|
||||||
APP.conference.addListener(
|
APP.conference.addListener(
|
||||||
JitsiMeetConferenceEvents.DESKTOP_SHARING_ENABLED_CHANGED,
|
JitsiMeetConferenceEvents.DESKTOP_SHARING_ENABLED_CHANGED,
|
||||||
|
@ -126,10 +127,10 @@ class API {
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
_sendEvent(name, data = {}) {
|
_sendEvent(name, data = {}) {
|
||||||
if (this.enabled) {
|
if (this._enabled) {
|
||||||
transport.sendEvent({
|
transport.sendEvent({
|
||||||
name,
|
data,
|
||||||
data
|
name
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -151,17 +152,15 @@ class API {
|
||||||
* @param {Object} options - Object with the message properties.
|
* @param {Object} options - Object with the message properties.
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
notifyReceivedChatMessage(options = {}) {
|
notifyReceivedChatMessage({ body, id, nick, ts } = {}) {
|
||||||
const { id, nick, body, ts } = options;
|
|
||||||
|
|
||||||
if (APP.conference.isLocalId(id)) {
|
if (APP.conference.isLocalId(id)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this._sendEvent('incoming-message', {
|
this._sendEvent('incoming-message', {
|
||||||
from: id,
|
from: id,
|
||||||
nick,
|
|
||||||
message: body,
|
message: body,
|
||||||
|
nick,
|
||||||
stamp: ts
|
stamp: ts
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -198,8 +197,8 @@ class API {
|
||||||
*/
|
*/
|
||||||
notifyDisplayNameChanged(id, displayname) {
|
notifyDisplayNameChanged(id, displayname) {
|
||||||
this._sendEvent('display-name-change', {
|
this._sendEvent('display-name-change', {
|
||||||
id,
|
displayname,
|
||||||
displayname
|
id
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -241,8 +240,8 @@ class API {
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
dispose() {
|
dispose() {
|
||||||
if (this.enabled) {
|
if (this._enabled) {
|
||||||
this.enabled = false;
|
this._enabled = false;
|
||||||
APP.conference.removeListener(
|
APP.conference.removeListener(
|
||||||
JitsiMeetConferenceEvents.DESKTOP_SHARING_ENABLED_CHANGED,
|
JitsiMeetConferenceEvents.DESKTOP_SHARING_ENABLED_CHANGED,
|
||||||
onDesktopSharingEnabledChanged);
|
onDesktopSharingEnabledChanged);
|
||||||
|
|
|
@ -3,5 +3,4 @@ declare var getConfigParamsFromUrl: Function;
|
||||||
/**
|
/**
|
||||||
* JitsiMeetExternalAPI id - unique for a webpage.
|
* JitsiMeetExternalAPI id - unique for a webpage.
|
||||||
*/
|
*/
|
||||||
export const API_ID
|
export const API_ID = getConfigParamsFromUrl().jitsi_meet_external_api_id;
|
||||||
= getConfigParamsFromUrl().jitsi_meet_external_api_id;
|
|
||||||
|
|
|
@ -81,8 +81,8 @@ function configToURLParamsArray(config = {}) {
|
||||||
|
|
||||||
for (const key in config) { // eslint-disable-line guard-for-in
|
for (const key in config) { // eslint-disable-line guard-for-in
|
||||||
try {
|
try {
|
||||||
params.push(`${key}=${
|
params.push(
|
||||||
encodeURIComponent(JSON.stringify(config[key]))}`);
|
`${key}=${encodeURIComponent(JSON.stringify(config[key]))}`);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.warn(`Error encoding ${key}: ${e}`);
|
console.warn(`Error encoding ${key}: ${e}`);
|
||||||
}
|
}
|
||||||
|
@ -233,14 +233,10 @@ class JitsiMeetExternalAPI extends EventEmitter {
|
||||||
*/
|
*/
|
||||||
_setupListeners() {
|
_setupListeners() {
|
||||||
|
|
||||||
this._transport.on('event', event => {
|
this._transport.on('event', ({ data, name }) => {
|
||||||
const { name, data } = event;
|
|
||||||
|
|
||||||
if (name === 'participant-joined') {
|
if (name === 'participant-joined') {
|
||||||
changeParticipantNumber(this, 1);
|
changeParticipantNumber(this, 1);
|
||||||
}
|
} else if (name === 'participant-left') {
|
||||||
|
|
||||||
if (name === 'participant-left') {
|
|
||||||
changeParticipantNumber(this, -1);
|
changeParticipantNumber(this, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -364,8 +360,8 @@ class JitsiMeetExternalAPI extends EventEmitter {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this._transport.sendEvent({
|
this._transport.sendEvent({
|
||||||
name: commands[name],
|
data: args,
|
||||||
data: args
|
name: commands[name]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
/* global APP, JitsiMeetJS, interfaceConfig, config */
|
/* global APP, config, interfaceConfig, JitsiMeetJS */
|
||||||
|
|
||||||
import * as JitsiMeetConferenceEvents from '../../ConferenceEvents';
|
import * as JitsiMeetConferenceEvents from '../../ConferenceEvents';
|
||||||
import {
|
import {
|
||||||
DISCO_REMOTE_CONTROL_FEATURE,
|
DISCO_REMOTE_CONTROL_FEATURE,
|
||||||
|
@ -10,8 +11,8 @@ import { transport } from '../transport';
|
||||||
|
|
||||||
import RemoteControlParticipant from "./RemoteControlParticipant";
|
import RemoteControlParticipant from "./RemoteControlParticipant";
|
||||||
|
|
||||||
const logger = require("jitsi-meet-logger").getLogger(__filename);
|
|
||||||
const ConferenceEvents = JitsiMeetJS.events.conference;
|
const ConferenceEvents = JitsiMeetJS.events.conference;
|
||||||
|
const logger = require("jitsi-meet-logger").getLogger(__filename);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class represents the receiver party for a remote controller session.
|
* This class represents the receiver party for a remote controller session.
|
||||||
|
@ -33,9 +34,9 @@ export default class Receiver extends RemoteControlParticipant {
|
||||||
this._hangupListener = this._onHangup.bind(this);
|
this._hangupListener = this._onHangup.bind(this);
|
||||||
// We expect here that even if we receive the supported event earlier
|
// We expect here that even if we receive the supported event earlier
|
||||||
// it will be cached and we'll receive it.
|
// it will be cached and we'll receive it.
|
||||||
transport.on('event', data => {
|
transport.on('event', ({ event, name }) => {
|
||||||
if(data.name === REMOTE_CONTROL_EVENT_TYPE) {
|
if(name === REMOTE_CONTROL_EVENT_TYPE) {
|
||||||
this._onRemoteControlAPIEvent(data.event);
|
this._onRemoteControlAPIEvent(event);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -193,7 +194,7 @@ export default class Receiver extends RemoteControlParticipant {
|
||||||
}
|
}
|
||||||
this._sendRemoteControlEvent(userId, {
|
this._sendRemoteControlEvent(userId, {
|
||||||
type: EVENT_TYPES.permissions,
|
type: EVENT_TYPES.permissions,
|
||||||
action: action
|
action
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -204,13 +205,12 @@ export default class Receiver extends RemoteControlParticipant {
|
||||||
*/
|
*/
|
||||||
_onRemoteControlAPIEvent(event) {
|
_onRemoteControlAPIEvent(event) {
|
||||||
switch(event.type) {
|
switch(event.type) {
|
||||||
case EVENT_TYPES.supported:
|
case EVENT_TYPES.supported:
|
||||||
this._onRemoteControlSupported();
|
this._onRemoteControlSupported();
|
||||||
break;
|
break;
|
||||||
case EVENT_TYPES.permissions:
|
case EVENT_TYPES.permissions:
|
||||||
this._onRemoteControlPermissionsEvent(
|
this._onRemoteControlPermissionsEvent(event.userId, event.action);
|
||||||
event.userId, event.action);
|
break;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,8 +25,9 @@ class RemoteControl {
|
||||||
* enabled or not.
|
* enabled or not.
|
||||||
*/
|
*/
|
||||||
init() {
|
init() {
|
||||||
if(config.disableRemoteControl || this.initialized
|
if(config.disableRemoteControl
|
||||||
|| !APP.conference.isDesktopSharingEnabled) {
|
|| this.initialized
|
||||||
|
|| !APP.conference.isDesktopSharingEnabled) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
logger.log("Initializing remote control.");
|
logger.log("Initializing remote control.");
|
||||||
|
@ -42,8 +43,9 @@ class RemoteControl {
|
||||||
* the user supports remote control and with false if not.
|
* the user supports remote control and with false if not.
|
||||||
*/
|
*/
|
||||||
checkUserRemoteControlSupport(user) {
|
checkUserRemoteControlSupport(user) {
|
||||||
return user.getFeatures().then(features =>
|
return user.getFeatures().then(
|
||||||
features.has(DISCO_REMOTE_CONTROL_FEATURE), () => false
|
features => features.has(DISCO_REMOTE_CONTROL_FEATURE),
|
||||||
|
() => false
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,14 @@
|
||||||
import Postis from 'postis';
|
import Postis from 'postis';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The default options for postis.
|
||||||
|
*
|
||||||
|
* @type {Object}
|
||||||
|
*/
|
||||||
|
const DEFAULT_POSTIS_OPTIONS = {
|
||||||
|
window: window.opener || window.parent
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The list of methods of incomming postis messages that we have to support for
|
* The list of methods of incomming postis messages that we have to support for
|
||||||
* backward compatability for the users that are directly sending messages to
|
* backward compatability for the users that are directly sending messages to
|
||||||
|
@ -7,9 +16,18 @@ import Postis from 'postis';
|
||||||
*
|
*
|
||||||
* @type {string[]}
|
* @type {string[]}
|
||||||
*/
|
*/
|
||||||
const legacyIncomingMethods = [ 'display-name', 'toggle-audio', 'toggle-video',
|
const LEGACY_INCOMING_METHODS = [
|
||||||
'toggle-film-strip', 'toggle-chat', 'toggle-contact-list',
|
'avatar-url',
|
||||||
'toggle-share-screen', 'video-hangup', 'email', 'avatar-url' ];
|
'display-name',
|
||||||
|
'email',
|
||||||
|
'toggle-audio',
|
||||||
|
'toggle-chat',
|
||||||
|
'toggle-contact-list',
|
||||||
|
'toggle-film-strip',
|
||||||
|
'toggle-share-screen',
|
||||||
|
'toggle-video',
|
||||||
|
'video-hangup'
|
||||||
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The list of methods of outgoing postis messages that we have to support for
|
* The list of methods of outgoing postis messages that we have to support for
|
||||||
|
@ -18,10 +36,16 @@ const legacyIncomingMethods = [ 'display-name', 'toggle-audio', 'toggle-video',
|
||||||
*
|
*
|
||||||
* @type {string[]}
|
* @type {string[]}
|
||||||
*/
|
*/
|
||||||
const legacyOutgoingMethods = [ 'display-name-change', 'incoming-message',
|
const LEGACY_OUTGOING_METHODS = [
|
||||||
'outgoing-message', 'participant-joined', 'participant-left',
|
'display-name-change',
|
||||||
'video-ready-to-close', 'video-conference-joined',
|
'incoming-message',
|
||||||
'video-conference-left' ];
|
'outgoing-message',
|
||||||
|
'participant-joined',
|
||||||
|
'participant-left',
|
||||||
|
'video-conference-joined',
|
||||||
|
'video-conference-left',
|
||||||
|
'video-ready-to-close'
|
||||||
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The postis method used for all messages.
|
* The postis method used for all messages.
|
||||||
|
@ -30,15 +54,6 @@ const legacyOutgoingMethods = [ 'display-name-change', 'incoming-message',
|
||||||
*/
|
*/
|
||||||
const POSTIS_METHOD_NAME = 'data';
|
const POSTIS_METHOD_NAME = 'data';
|
||||||
|
|
||||||
/**
|
|
||||||
* The default options for postis.
|
|
||||||
*
|
|
||||||
* @type {Object}
|
|
||||||
*/
|
|
||||||
const defaultPostisOptions = {
|
|
||||||
window: window.opener || window.parent
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implements message transport using the postMessage API.
|
* Implements message transport using the postMessage API.
|
||||||
*/
|
*/
|
||||||
|
@ -49,27 +64,30 @@ export default class PostMessageTransportBackend {
|
||||||
* @param {Object} options - Optional parameters for configuration of the
|
* @param {Object} options - Optional parameters for configuration of the
|
||||||
* transport.
|
* transport.
|
||||||
*/
|
*/
|
||||||
constructor(options = {}) {
|
constructor({ enableLegacyFormat, postisOptions } = {}) {
|
||||||
const postisOptions = Object.assign({}, defaultPostisOptions,
|
this.postis = Postis({
|
||||||
options.postisOptions);
|
...DEFAULT_POSTIS_OPTIONS,
|
||||||
|
...postisOptions
|
||||||
|
});
|
||||||
|
|
||||||
this.postis = Postis(postisOptions);
|
this._enableLegacyFormat = enableLegacyFormat;
|
||||||
|
|
||||||
this._enableLegacyFormat = options.enableLegacyFormat;
|
|
||||||
|
|
||||||
if (!this._enableLegacyFormat) {
|
if (!this._enableLegacyFormat) {
|
||||||
// backward compatability
|
// backward compatability
|
||||||
legacyIncomingMethods.forEach(method =>
|
LEGACY_INCOMING_METHODS.forEach(method =>
|
||||||
this.postis.listen(method,
|
this.postis.listen(
|
||||||
params => this._onPostisDataReceived(method, params)));
|
method,
|
||||||
|
params => this._legacyDataReceiveCallback(method, params)));
|
||||||
}
|
}
|
||||||
|
|
||||||
this.postis.listen(POSTIS_METHOD_NAME, data =>
|
this._receiveCallback = () => {
|
||||||
this._dataReceivedCallBack(data));
|
// Do nothing until a callback is set by the consumer of
|
||||||
|
// PostMessageTransportBackend via setReceiveCallback.
|
||||||
this._dataReceivedCallBack = () => {
|
|
||||||
// do nothing until real callback is set;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.postis.listen(
|
||||||
|
POSTIS_METHOD_NAME,
|
||||||
|
data => this._receiveCallback(data));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -79,15 +97,13 @@ export default class PostMessageTransportBackend {
|
||||||
* @param {Any} params - The params property from postis data object.
|
* @param {Any} params - The params property from postis data object.
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
_onPostisDataReceived(method, params = {}) {
|
_legacyDataReceiveCallback(method, params = {}) {
|
||||||
const newData = {
|
this._receiveCallback({
|
||||||
data: {
|
data: {
|
||||||
name: method,
|
name: method,
|
||||||
data: params
|
data: params
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
this._dataReceivedCallBack(newData);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -96,13 +112,11 @@ export default class PostMessageTransportBackend {
|
||||||
* @param {Object} data - The data to be sent.
|
* @param {Object} data - The data to be sent.
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
_sendLegacyData(data) {
|
_sendLegacyData({ data, name }) {
|
||||||
const method = data.name;
|
if (name && LEGACY_OUTGOING_METHODS.indexOf(name) !== -1) {
|
||||||
|
|
||||||
if (method && legacyOutgoingMethods.indexOf(method) !== -1) {
|
|
||||||
this.postis.send({
|
this.postis.send({
|
||||||
method,
|
method: name,
|
||||||
params: data.data
|
params: data
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -143,7 +157,7 @@ export default class PostMessageTransportBackend {
|
||||||
* @param {Function} callback - The new callback.
|
* @param {Function} callback - The new callback.
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
setDataReceivedCallback(callback) {
|
setReceiveCallback(callback) {
|
||||||
this._dataReceivedCallBack = callback;
|
this._receiveCallback = callback;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,9 +14,7 @@ export default class Transport {
|
||||||
* @param {Object} options - Optional parameters for configuration of the
|
* @param {Object} options - Optional parameters for configuration of the
|
||||||
* transport.
|
* transport.
|
||||||
*/
|
*/
|
||||||
constructor(options = {}) {
|
constructor({ transport } = {}) {
|
||||||
const { transport } = options;
|
|
||||||
|
|
||||||
this._requestID = 0;
|
this._requestID = 0;
|
||||||
|
|
||||||
this._responseHandlers = new Map();
|
this._responseHandlers = new Map();
|
||||||
|
@ -66,9 +64,9 @@ export default class Transport {
|
||||||
this.emit('request', data.data, (result, error) => {
|
this.emit('request', data.data, (result, error) => {
|
||||||
this._transport.send({
|
this._transport.send({
|
||||||
type: MESSAGE_TYPE_RESPONSE,
|
type: MESSAGE_TYPE_RESPONSE,
|
||||||
result,
|
|
||||||
error,
|
error,
|
||||||
id: data.id
|
id: data.id,
|
||||||
|
result
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
@ -97,22 +95,19 @@ export default class Transport {
|
||||||
*/
|
*/
|
||||||
emit(eventName, ...args) {
|
emit(eventName, ...args) {
|
||||||
const listenersForEvent = this._listeners.get(eventName);
|
const listenersForEvent = this._listeners.get(eventName);
|
||||||
|
|
||||||
if (!listenersForEvent || listenersForEvent.size === 0) {
|
|
||||||
this._unprocessedMessages.add(args);
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
let isProcessed = false;
|
let isProcessed = false;
|
||||||
|
|
||||||
listenersForEvent.forEach(listener => {
|
if (listenersForEvent && listenersForEvent.size) {
|
||||||
isProcessed = listener(...args) || isProcessed;
|
listenersForEvent.forEach(listener => {
|
||||||
});
|
isProcessed = listener(...args) || isProcessed;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (!isProcessed) {
|
if (!isProcessed) {
|
||||||
this._unprocessedMessages.add(args);
|
this._unprocessedMessages.add(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return isProcessed;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -146,7 +141,7 @@ export default class Transport {
|
||||||
/**
|
/**
|
||||||
* Removes all listeners, or those of the specified eventName.
|
* Removes all listeners, or those of the specified eventName.
|
||||||
*
|
*
|
||||||
* @param {string} [eventName] - The name of the event.
|
* @param {string} eventName - The name of the event.
|
||||||
* @returns {Transport} References to the instance of Transport class, so
|
* @returns {Transport} References to the instance of Transport class, so
|
||||||
* that calls can be chained.
|
* that calls can be chained.
|
||||||
*/
|
*/
|
||||||
|
@ -204,13 +199,13 @@ export default class Transport {
|
||||||
if (!this._transport) {
|
if (!this._transport) {
|
||||||
return Promise.reject(new Error('No transport defined!'));
|
return Promise.reject(new Error('No transport defined!'));
|
||||||
}
|
}
|
||||||
|
|
||||||
this._requestID++;
|
this._requestID++;
|
||||||
|
|
||||||
const id = this._requestID;
|
const id = this._requestID;
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
this._responseHandlers.set(this._requestID, response => {
|
this._responseHandlers.set(this._requestID, ({ error, result }) => {
|
||||||
const { result, error } = response;
|
|
||||||
|
|
||||||
if (result) {
|
if (result) {
|
||||||
resolve(result);
|
resolve(result);
|
||||||
} else if (error) {
|
} else if (error) {
|
||||||
|
@ -221,9 +216,9 @@ export default class Transport {
|
||||||
});
|
});
|
||||||
|
|
||||||
this._transport.send({
|
this._transport.send({
|
||||||
id,
|
|
||||||
type: MESSAGE_TYPE_REQUEST,
|
type: MESSAGE_TYPE_REQUEST,
|
||||||
data
|
data,
|
||||||
|
id
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -236,8 +231,8 @@ export default class Transport {
|
||||||
*/
|
*/
|
||||||
setTransport(transport) {
|
setTransport(transport) {
|
||||||
this._disposeTransport();
|
this._disposeTransport();
|
||||||
|
|
||||||
this._transport = transport;
|
this._transport = transport;
|
||||||
this._transport.setDataReceivedCallback(
|
this._transport.setReceiveCallback(this._onDataReceived.bind(this));
|
||||||
this._onDataReceived.bind(this));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,8 +12,7 @@ import PostMessageTransportBackend from './PostMessageTransportBackend';
|
||||||
const postisOptions = {};
|
const postisOptions = {};
|
||||||
|
|
||||||
if (typeof API_ID === 'number') {
|
if (typeof API_ID === 'number') {
|
||||||
postisOptions.scope
|
postisOptions.scope = `jitsi_meet_external_api_${API_ID}`;
|
||||||
= `jitsi_meet_external_api_${API_ID}`;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const transport = new Transport({
|
export const transport = new Transport({
|
||||||
|
|
Loading…
Reference in New Issue