Clarify variable names

This commit is contained in:
Kaitlyn Allan 2023-04-01 22:49:14 +10:00
parent b96fe57793
commit a3fa0a2f9c
3 changed files with 10 additions and 10 deletions

View file

@ -61,8 +61,8 @@ export default class extends Channel {
this.typers.delete(userId);
}
const keys = Array.from(this.typers.keys());
const users = await Users.packMany(keys, null, {
const userIds = Array.from(this.typers.keys());
const users = await Users.packMany(userIds, null, {
detail: false,
});

View file

@ -112,8 +112,8 @@ export default class extends Channel {
this.typers.delete(userId);
}
const ids = Array.from(this.typers.keys());
const users = await Users.packMany(ids, null, {
const userIds = Array.from(this.typers.keys());
const users = await Users.packMany(userIds, null, {
detail: false,
});

View file

@ -339,10 +339,10 @@ export default class Connection {
private onSubscribeNote(payload: any) {
if (!payload.id) return;
const c = this.subscribingNotes.get(payload.id) || 0;
this.subscribingNotes.set(payload.id, c + 1);
const current = this.subscribingNotes.get(payload.id) || 0;
this.subscribingNotes.set(payload.id, current + 1);
if (!c) {
if (!current) {
this.subscriber.on(`noteStream:${payload.id}`, this.onNoteStreamMessage);
}
}
@ -353,13 +353,13 @@ export default class Connection {
private onUnsubscribeNote(payload: any) {
if (!payload.id) return;
const c = this.subscribingNotes.get(payload.id) || 0;
if (c <= 1) {
const current = this.subscribingNotes.get(payload.id) || 0;
if (current <= 1) {
this.subscribingNotes.delete(payload.id);
this.subscriber.off(`noteStream:${payload.id}`, this.onNoteStreamMessage);
return;
}
this.subscribingNotes.set(payload.id, c - 1);
this.subscribingNotes.set(payload.id, current - 1);
}
private async onNoteStreamMessage(data: StreamMessages["note"]["payload"]) {