Enable @typescript-eslint/explicit-function-return-type
in /src (#9788)
* Enable `@typescript-eslint/explicit-member-accessibility` on /src * Prettier * Enable `@typescript-eslint/explicit-function-return-type` in /src * Fix types * tsc strict fixes * Delint * Fix test * Fix bad merge
This commit is contained in:
parent
7a36ba0fde
commit
030b7e90bf
683 changed files with 3459 additions and 3013 deletions
|
@ -274,7 +274,7 @@ export abstract class Call extends TypedEventEmitter<CallEvent, CallEventHandler
|
|||
/**
|
||||
* Manually marks the call as disconnected and cleans up.
|
||||
*/
|
||||
public setDisconnected() {
|
||||
public setDisconnected(): void {
|
||||
this.room.off(RoomEvent.MyMembership, this.onMyMembership);
|
||||
WidgetMessagingStore.instance.off(WidgetMessagingStoreEvent.StopMessaging, this.onStopMessaging);
|
||||
window.removeEventListener("beforeunload", this.beforeUnload);
|
||||
|
@ -285,23 +285,23 @@ export abstract class Call extends TypedEventEmitter<CallEvent, CallEventHandler
|
|||
/**
|
||||
* Stops all internal timers and tasks to prepare for garbage collection.
|
||||
*/
|
||||
public destroy() {
|
||||
public destroy(): void {
|
||||
if (this.connected) this.setDisconnected();
|
||||
this.emit(CallEvent.Destroy);
|
||||
}
|
||||
|
||||
private onMyMembership = async (_room: Room, membership: string) => {
|
||||
private onMyMembership = async (_room: Room, membership: string): Promise<void> => {
|
||||
if (membership !== "join") this.setDisconnected();
|
||||
};
|
||||
|
||||
private onStopMessaging = (uid: string) => {
|
||||
private onStopMessaging = (uid: string): void => {
|
||||
if (uid === this.widgetUid) {
|
||||
logger.log("The widget died; treating this as a user hangup");
|
||||
this.setDisconnected();
|
||||
}
|
||||
};
|
||||
|
||||
private beforeUnload = () => this.setDisconnected();
|
||||
private beforeUnload = (): void => this.setDisconnected();
|
||||
}
|
||||
|
||||
export interface JitsiCallMemberContent {
|
||||
|
@ -345,7 +345,7 @@ export class JitsiCall extends Call {
|
|||
await WidgetUtils.addJitsiWidget(room.roomId, CallType.Video, "Group call", true, room.name);
|
||||
}
|
||||
|
||||
private updateParticipants() {
|
||||
private updateParticipants(): void {
|
||||
if (this.participantsExpirationTimer !== null) {
|
||||
clearTimeout(this.participantsExpirationTimer);
|
||||
this.participantsExpirationTimer = null;
|
||||
|
@ -464,17 +464,17 @@ export class JitsiCall extends Call {
|
|||
const dontStopMessaging = new Promise<void>((resolve, reject) => {
|
||||
const messagingStore = WidgetMessagingStore.instance;
|
||||
|
||||
const listener = (uid: string) => {
|
||||
const listener = (uid: string): void => {
|
||||
if (uid === this.widgetUid) {
|
||||
cleanup();
|
||||
reject(new Error("Messaging stopped"));
|
||||
}
|
||||
};
|
||||
const done = () => {
|
||||
const done = (): void => {
|
||||
cleanup();
|
||||
resolve();
|
||||
};
|
||||
const cleanup = () => {
|
||||
const cleanup = (): void => {
|
||||
messagingStore.off(WidgetMessagingStoreEvent.StopMessaging, listener);
|
||||
this.off(CallEvent.ConnectionState, done);
|
||||
};
|
||||
|
@ -538,7 +538,7 @@ export class JitsiCall extends Call {
|
|||
}
|
||||
}
|
||||
|
||||
public setDisconnected() {
|
||||
public setDisconnected(): void {
|
||||
this.messaging!.off(`action:${ElementWidgetActions.HangupCall}`, this.onHangup);
|
||||
ActiveWidgetStore.instance.off(ActiveWidgetStoreEvent.Dock, this.onDock);
|
||||
ActiveWidgetStore.instance.off(ActiveWidgetStoreEvent.Undock, this.onUndock);
|
||||
|
@ -546,7 +546,7 @@ export class JitsiCall extends Call {
|
|||
super.setDisconnected();
|
||||
}
|
||||
|
||||
public destroy() {
|
||||
public destroy(): void {
|
||||
this.room.off(RoomStateEvent.Update, this.onRoomState);
|
||||
this.on(CallEvent.ConnectionState, this.onConnectionState);
|
||||
if (this.participantsExpirationTimer !== null) {
|
||||
|
@ -561,16 +561,16 @@ export class JitsiCall extends Call {
|
|||
super.destroy();
|
||||
}
|
||||
|
||||
private onRoomState = () => this.updateParticipants();
|
||||
private onRoomState = (): void => this.updateParticipants();
|
||||
|
||||
private onConnectionState = async (state: ConnectionState, prevState: ConnectionState) => {
|
||||
private onConnectionState = async (state: ConnectionState, prevState: ConnectionState): Promise<void> => {
|
||||
if (state === ConnectionState.Connected && !isConnected(prevState)) {
|
||||
this.updateParticipants(); // Local echo
|
||||
|
||||
// Tell others that we're connected, by adding our device to room state
|
||||
await this.addOurDevice();
|
||||
// Re-add this device every so often so our video member event doesn't become stale
|
||||
this.resendDevicesTimer = window.setInterval(async () => {
|
||||
this.resendDevicesTimer = window.setInterval(async (): Promise<void> => {
|
||||
logger.log(`Resending video member event for ${this.roomId}`);
|
||||
await this.addOurDevice();
|
||||
}, (this.STUCK_DEVICE_TIMEOUT_MS * 3) / 4);
|
||||
|
@ -586,18 +586,18 @@ export class JitsiCall extends Call {
|
|||
}
|
||||
};
|
||||
|
||||
private onDock = async () => {
|
||||
private onDock = async (): Promise<void> => {
|
||||
// The widget is no longer a PiP, so let's restore the default layout
|
||||
await this.messaging!.transport.send(ElementWidgetActions.TileLayout, {});
|
||||
};
|
||||
|
||||
private onUndock = async () => {
|
||||
private onUndock = async (): Promise<void> => {
|
||||
// The widget has become a PiP, so let's switch Jitsi to spotlight mode
|
||||
// to only show the active speaker and economize on space
|
||||
await this.messaging!.transport.send(ElementWidgetActions.SpotlightLayout, {});
|
||||
};
|
||||
|
||||
private onHangup = async (ev: CustomEvent<IWidgetApiRequest>) => {
|
||||
private onHangup = async (ev: CustomEvent<IWidgetApiRequest>): Promise<void> => {
|
||||
// If we're already in the middle of a client-initiated disconnection,
|
||||
// ignore the event
|
||||
if (this.connectionState === ConnectionState.Disconnecting) return;
|
||||
|
@ -763,7 +763,7 @@ export class ElementCall extends Call {
|
|||
}
|
||||
}
|
||||
|
||||
public setDisconnected() {
|
||||
public setDisconnected(): void {
|
||||
this.messaging!.off(`action:${ElementWidgetActions.HangupCall}`, this.onHangup);
|
||||
this.messaging!.off(`action:${ElementWidgetActions.TileLayout}`, this.onTileLayout);
|
||||
this.messaging!.off(`action:${ElementWidgetActions.SpotlightLayout}`, this.onSpotlightLayout);
|
||||
|
@ -772,7 +772,7 @@ export class ElementCall extends Call {
|
|||
this.groupCall.enteredViaAnotherSession = false;
|
||||
}
|
||||
|
||||
public destroy() {
|
||||
public destroy(): void {
|
||||
WidgetStore.instance.removeVirtualWidget(this.widget.id, this.groupCall.room.roomId);
|
||||
this.off(CallEvent.Participants, this.onParticipants);
|
||||
this.groupCall.off(GroupCallEvent.ParticipantsChanged, this.onGroupCallParticipants);
|
||||
|
@ -796,7 +796,7 @@ export class ElementCall extends Call {
|
|||
await this.messaging!.transport.send(action, {});
|
||||
}
|
||||
|
||||
private updateParticipants() {
|
||||
private updateParticipants(): void {
|
||||
const participants = new Map<RoomMember, Set<string>>();
|
||||
|
||||
for (const [member, deviceMap] of this.groupCall.participants) {
|
||||
|
@ -816,7 +816,7 @@ export class ElementCall extends Call {
|
|||
private onParticipants = async (
|
||||
participants: Map<RoomMember, Set<string>>,
|
||||
prevParticipants: Map<RoomMember, Set<string>>,
|
||||
) => {
|
||||
): Promise<void> => {
|
||||
let participantCount = 0;
|
||||
for (const devices of participants.values()) participantCount += devices.size;
|
||||
|
||||
|
@ -844,31 +844,31 @@ export class ElementCall extends Call {
|
|||
}
|
||||
};
|
||||
|
||||
private onGroupCallParticipants = () => this.updateParticipants();
|
||||
private onGroupCallParticipants = (): void => this.updateParticipants();
|
||||
|
||||
private onGroupCallState = (state: GroupCallState) => {
|
||||
private onGroupCallState = (state: GroupCallState): void => {
|
||||
if (state === GroupCallState.Ended) this.destroy();
|
||||
};
|
||||
|
||||
private onHangup = async (ev: CustomEvent<IWidgetApiRequest>) => {
|
||||
private onHangup = async (ev: CustomEvent<IWidgetApiRequest>): Promise<void> => {
|
||||
ev.preventDefault();
|
||||
await this.messaging!.transport.reply(ev.detail, {}); // ack
|
||||
this.setDisconnected();
|
||||
};
|
||||
|
||||
private onTileLayout = async (ev: CustomEvent<IWidgetApiRequest>) => {
|
||||
private onTileLayout = async (ev: CustomEvent<IWidgetApiRequest>): Promise<void> => {
|
||||
ev.preventDefault();
|
||||
this.layout = Layout.Tile;
|
||||
await this.messaging!.transport.reply(ev.detail, {}); // ack
|
||||
};
|
||||
|
||||
private onSpotlightLayout = async (ev: CustomEvent<IWidgetApiRequest>) => {
|
||||
private onSpotlightLayout = async (ev: CustomEvent<IWidgetApiRequest>): Promise<void> => {
|
||||
ev.preventDefault();
|
||||
this.layout = Layout.Spotlight;
|
||||
await this.messaging!.transport.reply(ev.detail, {}); // ack
|
||||
};
|
||||
|
||||
private onScreenshareRequest = async (ev: CustomEvent<IWidgetApiRequest>) => {
|
||||
private onScreenshareRequest = async (ev: CustomEvent<IWidgetApiRequest>): Promise<void> => {
|
||||
ev.preventDefault();
|
||||
|
||||
if (PlatformPeg.get().supportsDesktopCapturer()) {
|
||||
|
|
|
@ -30,7 +30,7 @@ export class RoomUpload {
|
|||
public fileSize = 0,
|
||||
) {}
|
||||
|
||||
public onProgress(progress: UploadProgress) {
|
||||
public onProgress(progress: UploadProgress): void {
|
||||
this.uploaded = progress.loaded;
|
||||
this.fileSize = progress.total;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue