Prefix and clarify global variable naming.
This commit is contained in:
parent
7755a3ce90
commit
d5465cf2fa
1 changed files with 11 additions and 11 deletions
|
@ -20,22 +20,22 @@ import ScalarMessaging from './ScalarMessaging';
|
||||||
import ScalarAuthClient from './ScalarAuthClient';
|
import ScalarAuthClient from './ScalarAuthClient';
|
||||||
import RoomViewStore from './stores/RoomViewStore';
|
import RoomViewStore from './stores/RoomViewStore';
|
||||||
|
|
||||||
if (!global.im) {
|
if (!global.mxIntegrationManager) {
|
||||||
global.im = {};
|
global.mxIntegrationManager = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class IntegrationManager {
|
export default class IntegrationManager {
|
||||||
static async _init() {
|
static async _init() {
|
||||||
if (!global.im.client || !global.im.connected) {
|
if (!global.mxIntegrationManager.client || !global.mxIntegrationManager.connected) {
|
||||||
if (SdkConfig.get().integrations_ui_url && SdkConfig.get().integrations_rest_url) {
|
if (SdkConfig.get().integrations_ui_url && SdkConfig.get().integrations_rest_url) {
|
||||||
ScalarMessaging.startListening();
|
ScalarMessaging.startListening();
|
||||||
global.im.client = new ScalarAuthClient();
|
global.mxIntegrationManager.client = new ScalarAuthClient();
|
||||||
|
|
||||||
await global.im.client.connect().then(() => {
|
await global.mxIntegrationManager.client.connect().then(() => {
|
||||||
global.im.connected = true;
|
global.mxIntegrationManager.connected = true;
|
||||||
}).catch((e) => {
|
}).catch((e) => {
|
||||||
console.error("Failed to connect to integrations server", e);
|
console.error("Failed to connect to integrations server", e);
|
||||||
global.im.error = e;
|
global.mxIntegrationManager.error = e;
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
console.error('Invalid integration manager config', SdkConfig.get());
|
console.error('Invalid integration manager config', SdkConfig.get());
|
||||||
|
@ -52,13 +52,13 @@ export default class IntegrationManager {
|
||||||
static async open(integType, integId, onClose) {
|
static async open(integType, integId, onClose) {
|
||||||
await IntegrationManager._init();
|
await IntegrationManager._init();
|
||||||
const IntegrationsManager = sdk.getComponent("views.settings.IntegrationsManager");
|
const IntegrationsManager = sdk.getComponent("views.settings.IntegrationsManager");
|
||||||
if (global.im.error || !(global.im.client && global.im.client.hasCredentials())) {
|
if (global.mxIntegrationManager.error || !(global.mxIntegrationManager.client && global.mxIntegrationManager.client.hasCredentials())) {
|
||||||
console.error("Scalar error", global.im);
|
console.error("Scalar error", global.mxIntegrationManager);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
integType = 'type_' + integType;
|
integType = 'type_' + integType;
|
||||||
const src = (global.im.client && global.im.client.hasCredentials()) ?
|
const src = (global.mxIntegrationManager.client && global.mxIntegrationManager.client.hasCredentials()) ?
|
||||||
global.im.client.getScalarInterfaceUrlForRoom(
|
global.mxIntegrationManager.client.getScalarInterfaceUrlForRoom(
|
||||||
RoomViewStore.getRoomId(),
|
RoomViewStore.getRoomId(),
|
||||||
integType,
|
integType,
|
||||||
integId,
|
integId,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue