Fix exports for rate limited functions and MatrixClientPeg

MatrixClientPeg in particular doesn't work very well with this.
This commit is contained in:
Travis Ralston 2019-12-12 19:33:08 -07:00
parent f5264db028
commit 225695ab5c
4 changed files with 8 additions and 7 deletions

View file

@ -48,7 +48,7 @@ interface MatrixClientCreds {
* This module provides a singleton instance of this class so the 'current' * This module provides a singleton instance of this class so the 'current'
* Matrix Client object is available easily. * Matrix Client object is available easily.
*/ */
class MatrixClientPeg { class _MatrixClientPeg {
constructor() { constructor() {
this.matrixClient = null; this.matrixClient = null;
this._justRegisteredUserId = null; this._justRegisteredUserId = null;
@ -245,6 +245,7 @@ class MatrixClientPeg {
} }
if (!global.mxMatrixClientPeg) { if (!global.mxMatrixClientPeg) {
global.mxMatrixClientPeg = new MatrixClientPeg(); global.mxMatrixClientPeg = new _MatrixClientPeg();
} }
export default global.mxMatrixClientPeg; export default global.mxMatrixClientPeg;
export const MatrixClientPeg = global.mxMatrixClientPeg;

View file

@ -887,7 +887,7 @@ module.exports = createReactClass({
// rate limited because a power level change will emit an event for every // rate limited because a power level change will emit an event for every
// member in the room. // member in the room.
_updateRoomMembers: new rate_limited_func(function(dueToMember) { _updateRoomMembers: rate_limited_func(function(dueToMember) {
// a member state changed in this room // a member state changed in this room
// refresh the conf call notification state // refresh the conf call notification state
this._updateConfCallNotification(); this._updateConfCallNotification();

View file

@ -23,9 +23,9 @@ import SdkConfig from '../../../SdkConfig';
import dis from '../../../dispatcher'; import dis from '../../../dispatcher';
import AutoHideScrollbar from "../../structures/AutoHideScrollbar"; import AutoHideScrollbar from "../../structures/AutoHideScrollbar";
import {isValid3pidInvite} from "../../../RoomInvite"; import {isValid3pidInvite} from "../../../RoomInvite";
import rate_limited_func from "../../../ratelimitedfunc";
const MatrixClientPeg = require("../../../MatrixClientPeg"); const MatrixClientPeg = require("../../../MatrixClientPeg");
const sdk = require('../../../index'); const sdk = require('../../../index');
const rate_limited_func = require('../../../ratelimitedfunc');
const CallHandler = require("../../../CallHandler"); const CallHandler = require("../../../CallHandler");
const INITIAL_LOAD_NUM_MEMBERS = 30; const INITIAL_LOAD_NUM_MEMBERS = 30;
@ -187,7 +187,7 @@ module.exports = createReactClass({
} }
}, },
_updateList: new rate_limited_func(function() { _updateList: rate_limited_func(function() {
this._updateListNow(); this._updateListNow();
}, 500), }, 500),

View file

@ -27,7 +27,7 @@ const MatrixClientPeg = require("../../../MatrixClientPeg");
const CallHandler = require('../../../CallHandler'); const CallHandler = require('../../../CallHandler');
const dis = require("../../../dispatcher"); const dis = require("../../../dispatcher");
const sdk = require('../../../index'); const sdk = require('../../../index');
const rate_limited_func = require('../../../ratelimitedfunc'); import rate_limited_func from "../../../ratelimitedfunc";
import * as Rooms from '../../../Rooms'; import * as Rooms from '../../../Rooms';
import DMRoomMap from '../../../utils/DMRoomMap'; import DMRoomMap from '../../../utils/DMRoomMap';
const Receipt = require('../../../utils/Receipt'); const Receipt = require('../../../utils/Receipt');
@ -384,7 +384,7 @@ module.exports = createReactClass({
this._delayedRefreshRoomList(); this._delayedRefreshRoomList();
}, },
_delayedRefreshRoomList: new rate_limited_func(function() { _delayedRefreshRoomList: rate_limited_func(function() {
this.refreshRoomList(); this.refreshRoomList();
}, 500), }, 500),