fix references to nullable subscriber object
This commit is contained in:
parent
e1639f70df
commit
3ecfb02aaf
17 changed files with 33 additions and 33 deletions
|
|
@ -18,7 +18,7 @@ class AdminChannel extends Channel {
|
|||
@bindThis
|
||||
public async init(params: JsonObject) {
|
||||
// Subscribe admin stream
|
||||
this.subscriber.on(`adminStream:${this.user!.id}`, data => {
|
||||
this.subscriber?.on(`adminStream:${this.user!.id}`, data => {
|
||||
this.send(data);
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ class AntennaChannel extends Channel {
|
|||
this.antennaId = params.antennaId;
|
||||
|
||||
// Subscribe stream
|
||||
this.subscriber.on(`antennaStream:${this.antennaId}`, this.onEvent);
|
||||
this.subscriber?.on(`antennaStream:${this.antennaId}`, this.onEvent);
|
||||
}
|
||||
|
||||
@bindThis
|
||||
|
|
@ -52,7 +52,7 @@ class AntennaChannel extends Channel {
|
|||
@bindThis
|
||||
public dispose() {
|
||||
// Unsubscribe events
|
||||
this.subscriber.off(`antennaStream:${this.antennaId}`, this.onEvent);
|
||||
this.subscriber?.off(`antennaStream:${this.antennaId}`, this.onEvent);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ class BubbleTimelineChannel extends Channel {
|
|||
this.withBots = !!(params.withBots ?? true);
|
||||
|
||||
// Subscribe events
|
||||
this.subscriber.on('notesStream', this.onNote);
|
||||
this.subscriber?.on('notesStream', this.onNote);
|
||||
}
|
||||
|
||||
@bindThis
|
||||
|
|
@ -85,7 +85,7 @@ class BubbleTimelineChannel extends Channel {
|
|||
@bindThis
|
||||
public dispose() {
|
||||
// Unsubscribe events
|
||||
this.subscriber.off('notesStream', this.onNote);
|
||||
this.subscriber?.off('notesStream', this.onNote);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ class ChannelChannel extends Channel {
|
|||
this.withRenotes = !!(params.withRenotes ?? true);
|
||||
|
||||
// Subscribe stream
|
||||
this.subscriber.on('notesStream', this.onNote);
|
||||
this.subscriber?.on('notesStream', this.onNote);
|
||||
}
|
||||
|
||||
@bindThis
|
||||
|
|
@ -56,7 +56,7 @@ class ChannelChannel extends Channel {
|
|||
@bindThis
|
||||
public dispose() {
|
||||
// Unsubscribe events
|
||||
this.subscriber.off('notesStream', this.onNote);
|
||||
this.subscriber?.off('notesStream', this.onNote);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ class ChatRoomChannel extends Channel {
|
|||
if (typeof params.roomId !== 'string') return;
|
||||
this.roomId = params.roomId;
|
||||
|
||||
this.subscriber.on(`chatRoomStream:${this.roomId}`, this.onEvent);
|
||||
this.subscriber?.on(`chatRoomStream:${this.roomId}`, this.onEvent);
|
||||
}
|
||||
|
||||
@bindThis
|
||||
|
|
@ -54,7 +54,7 @@ class ChatRoomChannel extends Channel {
|
|||
|
||||
@bindThis
|
||||
public dispose() {
|
||||
this.subscriber.off(`chatRoomStream:${this.roomId}`, this.onEvent);
|
||||
this.subscriber?.off(`chatRoomStream:${this.roomId}`, this.onEvent);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ class ChatUserChannel extends Channel {
|
|||
if (typeof params.otherId !== 'string') return;
|
||||
this.otherId = params.otherId;
|
||||
|
||||
this.subscriber.on(`chatUserStream:${this.user!.id}-${this.otherId}`, this.onEvent);
|
||||
this.subscriber?.on(`chatUserStream:${this.user!.id}-${this.otherId}`, this.onEvent);
|
||||
}
|
||||
|
||||
@bindThis
|
||||
|
|
@ -54,7 +54,7 @@ class ChatUserChannel extends Channel {
|
|||
|
||||
@bindThis
|
||||
public dispose() {
|
||||
this.subscriber.off(`chatUserStream:${this.user!.id}-${this.otherId}`, this.onEvent);
|
||||
this.subscriber?.off(`chatUserStream:${this.user!.id}-${this.otherId}`, this.onEvent);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ class DriveChannel extends Channel {
|
|||
@bindThis
|
||||
public async init(params: JsonObject) {
|
||||
// Subscribe drive stream
|
||||
this.subscriber.on(`driveStream:${this.user!.id}`, data => {
|
||||
this.subscriber?.on(`driveStream:${this.user!.id}`, data => {
|
||||
this.send(data);
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ class GlobalTimelineChannel extends Channel {
|
|||
this.withBots = !!(params.withBots ?? true);
|
||||
|
||||
// Subscribe events
|
||||
this.subscriber.on('notesStream', this.onNote);
|
||||
this.subscriber?.on('notesStream', this.onNote);
|
||||
}
|
||||
|
||||
@bindThis
|
||||
|
|
@ -86,7 +86,7 @@ class GlobalTimelineChannel extends Channel {
|
|||
@bindThis
|
||||
public dispose() {
|
||||
// Unsubscribe events
|
||||
this.subscriber.off('notesStream', this.onNote);
|
||||
this.subscriber?.off('notesStream', this.onNote);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ class HashtagChannel extends Channel {
|
|||
this.q = params.q;
|
||||
|
||||
// Subscribe stream
|
||||
this.subscriber.on('notesStream', this.onNote);
|
||||
this.subscriber?.on('notesStream', this.onNote);
|
||||
}
|
||||
|
||||
@bindThis
|
||||
|
|
@ -52,7 +52,7 @@ class HashtagChannel extends Channel {
|
|||
@bindThis
|
||||
public dispose() {
|
||||
// Unsubscribe events
|
||||
this.subscriber.off('notesStream', this.onNote);
|
||||
this.subscriber?.off('notesStream', this.onNote);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ class HomeTimelineChannel extends Channel {
|
|||
this.withRenotes = !!(params.withRenotes ?? true);
|
||||
this.withFiles = !!(params.withFiles ?? false);
|
||||
|
||||
this.subscriber.on('notesStream', this.onNote);
|
||||
this.subscriber?.on('notesStream', this.onNote);
|
||||
}
|
||||
|
||||
@bindThis
|
||||
|
|
@ -80,7 +80,7 @@ class HomeTimelineChannel extends Channel {
|
|||
@bindThis
|
||||
public dispose() {
|
||||
// Unsubscribe events
|
||||
this.subscriber.off('notesStream', this.onNote);
|
||||
this.subscriber?.off('notesStream', this.onNote);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ class HybridTimelineChannel extends Channel {
|
|||
this.withBots = !!(params.withBots ?? true);
|
||||
|
||||
// Subscribe events
|
||||
this.subscriber.on('notesStream', this.onNote);
|
||||
this.subscriber?.on('notesStream', this.onNote);
|
||||
}
|
||||
|
||||
@bindThis
|
||||
|
|
@ -97,7 +97,7 @@ class HybridTimelineChannel extends Channel {
|
|||
@bindThis
|
||||
public dispose(): void {
|
||||
// Unsubscribe events
|
||||
this.subscriber.off('notesStream', this.onNote);
|
||||
this.subscriber?.off('notesStream', this.onNote);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ class LocalTimelineChannel extends Channel {
|
|||
this.withBots = !!(params.withBots ?? true);
|
||||
|
||||
// Subscribe events
|
||||
this.subscriber.on('notesStream', this.onNote);
|
||||
this.subscriber?.on('notesStream', this.onNote);
|
||||
}
|
||||
|
||||
@bindThis
|
||||
|
|
@ -89,7 +89,7 @@ class LocalTimelineChannel extends Channel {
|
|||
@bindThis
|
||||
public dispose() {
|
||||
// Unsubscribe events
|
||||
this.subscriber.off('notesStream', this.onNote);
|
||||
this.subscriber?.off('notesStream', this.onNote);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ class MainChannel extends Channel {
|
|||
@bindThis
|
||||
public async init(params: JsonObject) {
|
||||
// Subscribe main stream channel
|
||||
this.subscriber.on(`mainStream:${this.user!.id}`, async data => {
|
||||
this.subscriber?.on(`mainStream:${this.user!.id}`, async data => {
|
||||
switch (data.type) {
|
||||
case 'notification': {
|
||||
// Ignore notifications from instances the user has muted
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ class ReversiGameChannel extends Channel {
|
|||
if (typeof params.gameId !== 'string') return;
|
||||
this.gameId = params.gameId;
|
||||
|
||||
this.subscriber.on(`reversiGameStream:${this.gameId}`, this.send);
|
||||
this.subscriber?.on(`reversiGameStream:${this.gameId}`, this.send);
|
||||
}
|
||||
|
||||
@bindThis
|
||||
|
|
@ -105,7 +105,7 @@ class ReversiGameChannel extends Channel {
|
|||
@bindThis
|
||||
public dispose() {
|
||||
// Unsubscribe events
|
||||
this.subscriber.off(`reversiGameStream:${this.gameId}`, this.send);
|
||||
this.subscriber?.off(`reversiGameStream:${this.gameId}`, this.send);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,13 +25,13 @@ class ReversiChannel extends Channel {
|
|||
|
||||
@bindThis
|
||||
public async init(params: JsonObject) {
|
||||
this.subscriber.on(`reversiStream:${this.user!.id}`, this.send);
|
||||
this.subscriber?.on(`reversiStream:${this.user!.id}`, this.send);
|
||||
}
|
||||
|
||||
@bindThis
|
||||
public dispose() {
|
||||
// Unsubscribe events
|
||||
this.subscriber.off(`reversiStream:${this.user!.id}`, this.send);
|
||||
this.subscriber?.off(`reversiStream:${this.user!.id}`, this.send);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ class RoleTimelineChannel extends Channel {
|
|||
if (typeof params.roleId !== 'string') return;
|
||||
this.roleId = params.roleId;
|
||||
|
||||
this.subscriber.on(`roleTimelineStream:${this.roleId}`, this.onEvent);
|
||||
this.subscriber?.on(`roleTimelineStream:${this.roleId}`, this.onEvent);
|
||||
}
|
||||
|
||||
@bindThis
|
||||
|
|
@ -80,7 +80,7 @@ class RoleTimelineChannel extends Channel {
|
|||
@bindThis
|
||||
public dispose() {
|
||||
// Unsubscribe events
|
||||
this.subscriber.off(`roleTimelineStream:${this.roleId}`, this.onEvent);
|
||||
this.subscriber?.off(`roleTimelineStream:${this.roleId}`, this.onEvent);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -54,9 +54,9 @@ class UserListChannel extends Channel {
|
|||
if (!listExist) return;
|
||||
|
||||
// Subscribe stream
|
||||
this.subscriber.on(`userListStream:${this.listId}`, this.send);
|
||||
this.subscriber?.on(`userListStream:${this.listId}`, this.send);
|
||||
|
||||
this.subscriber.on('notesStream', this.onNote);
|
||||
this.subscriber?.on('notesStream', this.onNote);
|
||||
|
||||
this.updateListUsers();
|
||||
this.listUsersClock = setInterval(this.updateListUsers, 5000);
|
||||
|
|
@ -121,8 +121,8 @@ class UserListChannel extends Channel {
|
|||
@bindThis
|
||||
public dispose() {
|
||||
// Unsubscribe events
|
||||
this.subscriber.off(`userListStream:${this.listId}`, this.send);
|
||||
this.subscriber.off('notesStream', this.onNote);
|
||||
this.subscriber?.off(`userListStream:${this.listId}`, this.send);
|
||||
this.subscriber?.off('notesStream', this.onNote);
|
||||
|
||||
clearInterval(this.listUsersClock);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue