doc
This commit is contained in:
+11
-9
@@ -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[]*
|
||||
|
||||
|
||||
@@ -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<SubResT = {}>(socket: I.Socket, exporter:I.Exporter<SubResT>, makeUnique = true):T.ExtendedRpcInfo[]{
|
||||
const owner = exporter.name
|
||||
const RPCs = [...exporter.exportRPCs()]
|
||||
|
||||
Reference in New Issue
Block a user