diff --git a/docs/modules/_utils_.md b/docs/modules/_utils_.md index f9137c2..b211c67 100644 --- a/docs/modules/_utils_.md +++ b/docs/modules/_utils_.md @@ -18,7 +18,7 @@ ▸ **extractArgs**(`f`: Function): *T.Arg[]* -Defined in Utils.ts:96 +Defined in Utils.ts:102 **Parameters:** @@ -34,7 +34,7 @@ ___ ▸ **hookGenerator**(`rpc`: T.HookRPC‹any›): *function* -Defined in Utils.ts:75 +Defined in Utils.ts:81 **Parameters:** @@ -58,7 +58,7 @@ ___ ▸ **makeSubResponse**(`uuid?`: undefined | string): *[SubscriptionResponse](_types_.md#subscriptionresponse)* -Defined in Utils.ts:101 +Defined in Utils.ts:107 **Parameters:** @@ -74,7 +74,9 @@ ___ ▸ **rpcHooker**<**SubResT**>(`socket`: [Socket](../interfaces/_interfaces_.socket.md), `exporter`: [Exporter](../interfaces/_interfaces_.exporter.md)‹SubResT›, `makeUnique`: boolean): *T.ExtendedRpcInfo[]* -Defined in Utils.ts:53 +Defined in Utils.ts:59 + +Utility function to apply the RPCs of an [Exporter](../interfaces/_interfaces_.exporter.md). **Type parameters:** @@ -82,11 +84,11 @@ Defined in Utils.ts:53 **Parameters:** -Name | Type | Default | ------- | ------ | ------ | -`socket` | [Socket](../interfaces/_interfaces_.socket.md) | - | -`exporter` | [Exporter](../interfaces/_interfaces_.exporter.md)‹SubResT› | - | -`makeUnique` | boolean | true | +Name | Type | Default | Description | +------ | ------ | ------ | ------ | +`socket` | [Socket](../interfaces/_interfaces_.socket.md) | - | The websocket (implementation: bsock) to hook on | +`exporter` | [Exporter](../interfaces/_interfaces_.exporter.md)‹SubResT› | - | The exporter | +`makeUnique` | boolean | true | @default true Attach a suffix to RPC names | **Returns:** *T.ExtendedRpcInfo[]* diff --git a/src/Utils.ts b/src/Utils.ts index 0ac9614..66b874c 100644 --- a/src/Utils.ts +++ b/src/Utils.ts @@ -50,6 +50,12 @@ RPC did not provide a name. throw new Error("Bad socketIORPC type "+ typeof rpc) } +/** + * Utility function to apply the RPCs of an {@link Exporter}. + * @param socket The websocket (implementation: bsock) to hook on + * @param exporter The exporter + * @param makeUnique @default true Attach a suffix to RPC names + */ export function rpcHooker(socket: I.Socket, exporter:I.Exporter, makeUnique = true):T.ExtendedRpcInfo[]{ const owner = exporter.name const RPCs = [...exporter.exportRPCs()]