Skip to content

Commit 06d0ff3

Browse files
committed
Apply some code quality suggestions from SonarQube
1 parent 326eb12 commit 06d0ff3

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/ClientWidgetApi.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ export class ClientWidgetApi extends EventEmitter {
230230

231231
public async getWidgetVersions(): Promise<ApiVersion[]> {
232232
if (Array.isArray(this.cachedWidgetVersions)) {
233-
return Promise.resolve(this.cachedWidgetVersions);
233+
return this.cachedWidgetVersions;
234234
}
235235

236236
try {
@@ -1141,7 +1141,7 @@ export class ClientWidgetApi extends EventEmitter {
11411141
private async flushRoomState(): Promise<void> {
11421142
try {
11431143
// Only send a single action once all concurrent tasks have completed
1144-
do await Promise.all([...this.pushRoomStateTasks]);
1144+
do await Promise.all(this.pushRoomStateTasks);
11451145
while (this.pushRoomStateTasks.size > 0);
11461146

11471147
const events: IRoomEvent[] = [];
@@ -1251,7 +1251,7 @@ export class ClientWidgetApi extends EventEmitter {
12511251
eventTypeMap.set(rawEvent.type, stateKeyMap);
12521252
}
12531253
if (!stateKeyMap.has(rawEvent.type)) stateKeyMap.set(rawEvent.state_key, rawEvent);
1254-
do await Promise.all([...this.pushRoomStateTasks]);
1254+
do await Promise.all(this.pushRoomStateTasks);
12551255
while (this.pushRoomStateTasks.size > 0);
12561256
await this.flushRoomStateTask;
12571257
}

src/WidgetApi.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,9 @@ export class WidgetApi extends EventEmitter {
191191
* @throws Throws if the capabilities negotiation has already started.
192192
*/
193193
public requestCapabilities(capabilities: Capability[]): void {
194-
capabilities.forEach((cap) => this.requestCapability(cap));
194+
for (const cap of capabilities) {
195+
this.requestCapability(cap);
196+
}
195197
}
196198

197199
/**

0 commit comments

Comments
 (0)