mirror of
https://gitcode.com/GitHub_Trending/ji/jitsi-meet.git
synced 2026-05-15 19:07:47 +00:00
* feat(analytics): move to React The analytics handlers have been moved to JitsiMeetGlobalNS, so now they are stored in `window.JitsiMeetJS.app.analyticsHandlers`. The analytics handlers are re-downloaded and re-initialized on every lib-jitsi-meet initialization, which happens every time the config is changed (moving between deployments in the mobile app). * Adds legacy support for old analytics location.
58 lines
1.4 KiB
JavaScript
58 lines
1.4 KiB
JavaScript
// FIXME: change to '../API' when we update to webpack2. If we do this now all
|
|
// files from API modules will be included in external_api.js.
|
|
import { API_ID } from '../API/constants';
|
|
import { getJitsiMeetGlobalNS } from '../../react/features/base/util';
|
|
|
|
import PostMessageTransportBackend from './PostMessageTransportBackend';
|
|
import Transport from './Transport';
|
|
|
|
export {
|
|
PostMessageTransportBackend,
|
|
Transport
|
|
};
|
|
|
|
/**
|
|
* Option for the default low level transport.
|
|
*
|
|
* @type {Object}
|
|
*/
|
|
const postisOptions = {};
|
|
|
|
if (typeof API_ID === 'number') {
|
|
postisOptions.scope = `jitsi_meet_external_api_${API_ID}`;
|
|
}
|
|
|
|
/**
|
|
* The instance of Transport class that will be used by Jitsi Meet.
|
|
*
|
|
* @type {Transport}
|
|
*/
|
|
let transport;
|
|
|
|
/**
|
|
* Returns the instance of Transport class that will be used by Jitsi Meet.
|
|
*
|
|
* @returns {Transport}
|
|
*/
|
|
export function getJitsiMeetTransport() {
|
|
if (!transport) {
|
|
transport = new Transport({
|
|
backend: new PostMessageTransportBackend({
|
|
enableLegacyFormat: true,
|
|
postisOptions
|
|
})
|
|
});
|
|
}
|
|
|
|
return transport;
|
|
}
|
|
|
|
/**
|
|
* Sets the transport to passed transport.
|
|
*
|
|
* @param {Object} externalTransportBackend - The new transport.
|
|
* @returns {void}
|
|
*/
|
|
getJitsiMeetGlobalNS().setExternalTransportBackend = externalTransportBackend =>
|
|
transport.setBackend(externalTransportBackend);
|