Tweak private / underscores for fields and methods

This commit is contained in:
J. Ryan Stinnett 2021-04-26 14:02:53 +01:00
parent f34489e2df
commit b8a915bb76
17 changed files with 324 additions and 325 deletions

View file

@ -25,7 +25,7 @@ const TYPING_SERVER_TIMEOUT = 30000;
* Tracks typing state for users.
*/
export default class TypingStore {
private _typingStates: {
private typingStates: {
[roomId: string]: {
isTyping: boolean,
userTimer: Timer,
@ -49,7 +49,7 @@ export default class TypingStore {
* MatrixClientPeg client changes.
*/
reset() {
this._typingStates = {
this.typingStates = {
// "roomId": {
// isTyping: bool, // Whether the user is typing or not
// userTimer: Timer, // Local timeout for "user has stopped typing"
@ -67,14 +67,14 @@ export default class TypingStore {
if (!SettingsStore.getValue('sendTypingNotifications')) return;
if (SettingsStore.getValue('lowBandwidth')) return;
let currentTyping = this._typingStates[roomId];
let currentTyping = this.typingStates[roomId];
if ((!isTyping && !currentTyping) || (currentTyping && currentTyping.isTyping === isTyping)) {
// No change in state, so don't do anything. We'll let the timer run its course.
return;
}
if (!currentTyping) {
currentTyping = this._typingStates[roomId] = {
currentTyping = this.typingStates[roomId] = {
isTyping: isTyping,
serverTimer: new Timer(TYPING_SERVER_TIMEOUT),
userTimer: new Timer(TYPING_USER_TIMEOUT),
@ -86,7 +86,7 @@ export default class TypingStore {
if (isTyping) {
if (!currentTyping.serverTimer.isRunning()) {
currentTyping.serverTimer.restart().finished().then(() => {
const currentTyping = this._typingStates[roomId];
const currentTyping = this.typingStates[roomId];
if (currentTyping) currentTyping.isTyping = false;
// The server will (should) time us out on typing, so we don't

View file

@ -23,7 +23,7 @@ import {WidgetType} from "../widgets/WidgetType";
* proxying through state from the js-sdk.
*/
class WidgetEchoStore extends EventEmitter {
private _roomWidgetEcho: {
private roomWidgetEcho: {
[roomId: string]: {
[widgetId: string]: IWidget,
},
@ -32,7 +32,7 @@ class WidgetEchoStore extends EventEmitter {
constructor() {
super();
this._roomWidgetEcho = {
this.roomWidgetEcho = {
// Map as below. Object is the content of the widget state event,
// so for widgets that have been deleted locally, the object is empty.
// roomId: {
@ -55,7 +55,7 @@ class WidgetEchoStore extends EventEmitter {
getEchoedRoomWidgets(roomId, currentRoomWidgets) {
const echoedWidgets = [];
const roomEchoState = Object.assign({}, this._roomWidgetEcho[roomId]);
const roomEchoState = Object.assign({}, this.roomWidgetEcho[roomId]);
for (const w of currentRoomWidgets) {
const widgetId = w.getStateKey();
@ -72,7 +72,7 @@ class WidgetEchoStore extends EventEmitter {
}
roomHasPendingWidgetsOfType(roomId, currentRoomWidgets, type?: WidgetType) {
const roomEchoState = Object.assign({}, this._roomWidgetEcho[roomId]);
const roomEchoState = Object.assign({}, this.roomWidgetEcho[roomId]);
// any widget IDs that are already in the room are not pending, so
// echoes for them don't count as pending.
@ -96,15 +96,15 @@ class WidgetEchoStore extends EventEmitter {
}
setRoomWidgetEcho(roomId: string, widgetId: string, state: IWidget) {
if (this._roomWidgetEcho[roomId] === undefined) this._roomWidgetEcho[roomId] = {};
if (this.roomWidgetEcho[roomId] === undefined) this.roomWidgetEcho[roomId] = {};
this._roomWidgetEcho[roomId][widgetId] = state;
this.roomWidgetEcho[roomId][widgetId] = state;
this.emit('update', roomId, widgetId);
}
removeRoomWidgetEcho(roomId, widgetId) {
delete this._roomWidgetEcho[roomId][widgetId];
if (Object.keys(this._roomWidgetEcho[roomId]).length === 0) delete this._roomWidgetEcho[roomId];
delete this.roomWidgetEcho[roomId][widgetId];
if (Object.keys(this.roomWidgetEcho[roomId]).length === 0) delete this.roomWidgetEcho[roomId];
this.emit('update', roomId, widgetId);
}
}