From 5bdbf7797180df0009b5269c6dae529d07a86ee6 Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Wed, 1 Feb 2023 13:45:21 -0500 Subject: [PATCH] *Add public api methods from hyperswarm --- src/index.ts | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/index.ts b/src/index.ts index 46e3b6b..4402a7c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -197,4 +197,29 @@ export default class HyperswarmWeb extends EventEmitter { this._queuedEmActions = []; } + + public join(topic: Uint8Array, opts = {}) { + return this._activeRelay?.join(topic, opts); + } + public joinPeer(publicKey: Uint8Array) { + return this._activeRelay?.joinPeer(publicKey); + } + public leave(topic: Uint8Array) { + return this._activeRelay?.leave(topic); + } + public leavePeer(publicKey: Uint8Array) { + return this._activeRelay?.leavePeer(publicKey); + } + public status(publicKey: Uint8Array) { + return this._activeRelay?.status(publicKey); + } + public topics(): string[] { + return this._activeRelay?.topics(); + } + public async flush(): Promise { + return this._activeRelay?.flush(); + } + public async clear(): Promise { + return this._activeRelay?.clear(); + } }