From a75c57b1e826a9f26fe25ec10873c0be81f7be5a Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Fri, 1 Sep 2023 08:02:05 -0400 Subject: [PATCH] feat: port listen method --- src/service/registry.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/service/registry.ts b/src/service/registry.ts index c4d31e5..b5c9257 100644 --- a/src/service/registry.ts +++ b/src/service/registry.ts @@ -209,6 +209,15 @@ export class RegistryService { return null; } + public listen(pk: Uint8Array): EventEmitter { + const key = new Multihash(pk).toString(); + if (!this.streams[key]) { + this.streams[key] = new EventEmitter(); + this.sendRegistryRequest(pk); + } + return this.streams[key]; + } + public deserializeRegistryEntry(event: Uint8Array): SignedRegistryEntry { const dataLength = event[42]; return {