From 10297bf818bd80707e30c5f911dc5cde33157e18 Mon Sep 17 00:00:00 2001 From: "fryorcraken.eth" Date: Tue, 20 Sep 2022 11:52:58 +1000 Subject: [PATCH] chore(relay-angular-chat): bump js-waku to 0.28.1 --- relay-angular-chat/package.json | 2 +- relay-angular-chat/pnpm-lock.yaml | 8 ++++---- .../src/app/messages/messages.component.ts | 12 ++++++------ 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/relay-angular-chat/package.json b/relay-angular-chat/package.json index c6fe5aa..04041e5 100644 --- a/relay-angular-chat/package.json +++ b/relay-angular-chat/package.json @@ -21,7 +21,7 @@ "@angular/platform-browser": "~14.2.0", "@angular/platform-browser-dynamic": "~14.2.0", "@angular/router": "~14.2.0", - "js-waku": "0.28.0", + "js-waku": "0.28.1", "protobufjs": "^7.1.0", "rxjs": "~7.5.0", "tslib": "^2.3.0", diff --git a/relay-angular-chat/pnpm-lock.yaml b/relay-angular-chat/pnpm-lock.yaml index 1d4eac8..b0dc8ee 100644 --- a/relay-angular-chat/pnpm-lock.yaml +++ b/relay-angular-chat/pnpm-lock.yaml @@ -16,7 +16,7 @@ specifiers: '@types/node': ^17.0.21 is-ci-cli: ^2.2.0 jasmine-core: ~4.3.0 - js-waku: 0.28.0 + js-waku: 0.28.1 karma: ~6.4.0 karma-chrome-launcher: ~3.1.0 karma-coverage: ~2.2.0 @@ -37,7 +37,7 @@ dependencies: '@angular/platform-browser': 14.2.0_afytwol7hs4qio34buyx2grhfa '@angular/platform-browser-dynamic': 14.2.0_owch6soaoexeadly32xw5vendq '@angular/router': 14.2.0_6lk4yxyxfaqzosenawf2bqx6vy - js-waku: 0.28.0 + js-waku: 0.28.1 protobufjs: 7.1.0 rxjs: 7.5.6 tslib: 2.4.0 @@ -5440,8 +5440,8 @@ packages: resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==} dev: true - /js-waku/0.28.0: - resolution: {integrity: sha512-MEIFugvio2IaQMQT+g+bn24BvlJ5S4PdSKD0AGVZlR7q1BhECwlpRoytyz0A/hC1+EJWhrZB8cpIAmxwtYWTBw==} + /js-waku/0.28.1: + resolution: {integrity: sha512-0h9TpV6jywyjdes8hr9tFV/5iJh3LQN3sQFYHcXyi4cK+4htNiMrCRjBSqRBtfhs/j+4tOkrht8gRJRLHdA5RA==} engines: {node: '>=16'} dependencies: '@chainsafe/libp2p-gossipsub': 4.1.1 diff --git a/relay-angular-chat/src/app/messages/messages.component.ts b/relay-angular-chat/src/app/messages/messages.component.ts index 4f64264..7b3cdd8 100644 --- a/relay-angular-chat/src/app/messages/messages.component.ts +++ b/relay-angular-chat/src/app/messages/messages.component.ts @@ -24,6 +24,7 @@ export class MessagesComponent implements OnInit { messageCount: number = 0; waku!: WakuPrivacy; wakuStatus!: string; + deleteObserver?: () => void; constructor(private wakuService: WakuService) {} @@ -34,18 +35,17 @@ export class MessagesComponent implements OnInit { this.wakuService.waku.subscribe((waku) => { this.waku = waku; - this.waku.relay.addObserver(this.processIncomingMessages, [ - this.contentTopic, - ]); + this.deleteObserver = this.waku.relay.addObserver( + this.processIncomingMessages, + [this.contentTopic] + ); }); window.onbeforeunload = () => this.ngOnDestroy(); } ngOnDestroy(): void { - this.waku.relay.deleteObserver(this.processIncomingMessages, [ - this.contentTopic, - ]); + if (this.deleteObserver) this.deleteObserver(); } sendMessage(): void {