mirror of
https://github.com/colanode/colanode.git
synced 2025-12-29 00:25:03 +01:00
Add destroy method for radar service
This commit is contained in:
@@ -16,6 +16,10 @@ export class NotificationService {
|
||||
eventBus.subscribe((event) => {
|
||||
if (event.type === 'radar_data_updated') {
|
||||
this.checkBadge();
|
||||
} else if (event.type === 'workspace_deleted') {
|
||||
this.checkBadge();
|
||||
} else if (event.type === 'account_deleted') {
|
||||
this.checkBadge();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -27,10 +27,11 @@ export class RadarService {
|
||||
private readonly workspace: WorkspaceService;
|
||||
private readonly unreadMessages: Map<string, UndreadMessage> = new Map();
|
||||
private readonly collaborations: Map<string, SelectCollaboration> = new Map();
|
||||
private readonly eventSubscriptionId: string;
|
||||
|
||||
constructor(workspace: WorkspaceService) {
|
||||
this.workspace = workspace;
|
||||
eventBus.subscribe(this.handleEvent.bind(this));
|
||||
this.eventSubscriptionId = eventBus.subscribe(this.handleEvent.bind(this));
|
||||
}
|
||||
|
||||
public getData(): WorkspaceRadarData {
|
||||
@@ -128,6 +129,10 @@ export class RadarService {
|
||||
}
|
||||
}
|
||||
|
||||
public destroy(): void {
|
||||
eventBus.unsubscribe(this.eventSubscriptionId);
|
||||
}
|
||||
|
||||
private async handleEvent(event: Event) {
|
||||
if (event.type === 'message_interaction_updated') {
|
||||
await this.handleMessageInteractionUpdated(event);
|
||||
|
||||
@@ -125,6 +125,7 @@ export class WorkspaceService {
|
||||
this.synchronizer.destroy();
|
||||
this.files.destroy();
|
||||
this.mutations.destroy();
|
||||
this.radar.destroy();
|
||||
|
||||
const workspacePath = getWorkspaceDirectoryPath(
|
||||
this.account.id,
|
||||
|
||||
Reference in New Issue
Block a user