Browse Source

doc

master
peter 4 years ago
parent
commit
887e51392d
2 changed files with 17 additions and 9 deletions
  1. 11
    9
      docs/modules/_utils_.md
  2. 6
    0
      src/Utils.ts

+ 11
- 9
docs/modules/_utils_.md View File

@@ -18,7 +18,7 @@
18 18
 
19 19
 ▸ **extractArgs**(`f`: Function): *T.Arg[]*
20 20
 
21
-Defined in Utils.ts:96
21
+Defined in Utils.ts:102
22 22
 
23 23
 **Parameters:**
24 24
 
@@ -34,7 +34,7 @@ ___
34 34
 
35 35
 ▸ **hookGenerator**(`rpc`: T.HookRPC‹any›): *function*
36 36
 
37
-Defined in Utils.ts:75
37
+Defined in Utils.ts:81
38 38
 
39 39
 **Parameters:**
40 40
 
@@ -58,7 +58,7 @@ ___
58 58
 
59 59
 ▸ **makeSubResponse**(`uuid?`: undefined | string): *[SubscriptionResponse](_types_.md#subscriptionresponse)*
60 60
 
61
-Defined in Utils.ts:101
61
+Defined in Utils.ts:107
62 62
 
63 63
 **Parameters:**
64 64
 
@@ -74,7 +74,9 @@ ___
74 74
 
75 75
 ▸ **rpcHooker**<**SubResT**>(`socket`: [Socket](../interfaces/_interfaces_.socket.md), `exporter`: [Exporter](../interfaces/_interfaces_.exporter.md)‹SubResT›, `makeUnique`: boolean): *T.ExtendedRpcInfo[]*
76 76
 
77
-Defined in Utils.ts:53
77
+Defined in Utils.ts:59
78
+
79
+Utility function to apply the RPCs of an [Exporter](../interfaces/_interfaces_.exporter.md).
78 80
 
79 81
 **Type parameters:**
80 82
 
@@ -82,11 +84,11 @@ Defined in Utils.ts:53
82 84
 
83 85
 **Parameters:**
84 86
 
85
-Name | Type | Default |
86
------- | ------ | ------ |
87
-`socket` | [Socket](../interfaces/_interfaces_.socket.md) | - |
88
-`exporter` | [Exporter](../interfaces/_interfaces_.exporter.md)‹SubResT› | - |
89
-`makeUnique` | boolean | true |
87
+Name | Type | Default | Description |
88
+------ | ------ | ------ | ------ |
89
+`socket` | [Socket](../interfaces/_interfaces_.socket.md) | - | The websocket (implementation: bsock) to hook on |
90
+`exporter` | [Exporter](../interfaces/_interfaces_.exporter.md)‹SubResT› | - | The exporter |
91
+`makeUnique` | boolean | true | @default true Attach a suffix to RPC names  |
90 92
 
91 93
 **Returns:** *T.ExtendedRpcInfo[]*
92 94
 

+ 6
- 0
src/Utils.ts View File

@@ -50,6 +50,12 @@ RPC did not provide a name.
50 50
     throw new Error("Bad socketIORPC type "+ typeof rpc)
51 51
 }
52 52
 
53
+/**
54
+ * Utility function to apply the RPCs of an {@link Exporter}.
55
+ * @param socket The websocket (implementation: bsock) to hook on
56
+ * @param exporter The exporter
57
+ * @param makeUnique @default true Attach a suffix to RPC names
58
+ */
53 59
 export function rpcHooker<SubResT = {}>(socket: I.Socket, exporter:I.Exporter<SubResT>, makeUnique = true):T.ExtendedRpcInfo[]{
54 60
     const owner = exporter.name
55 61
     const RPCs = [...exporter.exportRPCs()]

Loading…
Cancel
Save