Browse Source

doc

master
peter 5 years ago
parent
commit
3dadc48b32
2 changed files with 17 additions and 10 deletions
  1. 11
    9
      docs/modules/_utils_.md
  2. 6
    1
      src/Utils.ts

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

18
 
18
 
19
 ▸ **extractArgs**(`f`: Function): *T.Arg[]*
19
 ▸ **extractArgs**(`f`: Function): *T.Arg[]*
20
 
20
 
21
-Defined in Utils.ts:91
21
+Defined in Utils.ts:96
22
 
22
 
23
 **Parameters:**
23
 **Parameters:**
24
 
24
 
34
 
34
 
35
 ▸ **hookGenerator**(`rpc`: T.HookRPC‹any›): *function*
35
 ▸ **hookGenerator**(`rpc`: T.HookRPC‹any›): *function*
36
 
36
 
37
-Defined in Utils.ts:70
37
+Defined in Utils.ts:75
38
 
38
 
39
 **Parameters:**
39
 **Parameters:**
40
 
40
 
58
 
58
 
59
 ▸ **makeSubResponse**(`uuid?`: undefined | string): *[SubscriptionResponse](_types_.md#subscriptionresponse)*
59
 ▸ **makeSubResponse**(`uuid?`: undefined | string): *[SubscriptionResponse](_types_.md#subscriptionresponse)*
60
 
60
 
61
-Defined in Utils.ts:96
61
+Defined in Utils.ts:101
62
 
62
 
63
 **Parameters:**
63
 **Parameters:**
64
 
64
 
74
 
74
 
75
 ▸ **rpcHooker**<**SubResT**>(`socket`: [Socket](../interfaces/_interfaces_.socket.md), `exporter`: [Exporter](../interfaces/_interfaces_.exporter.md)‹SubResT›, `makeUnique`: boolean): *T.ExtendedRpcInfo[]*
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:48
77
+Defined in Utils.ts:53
78
 
78
 
79
 **Type parameters:**
79
 **Type parameters:**
80
 
80
 
96
 
96
 
97
 ▸ **rpcToRpcinfo**<**SubResT**>(`rpc`: T.RPC‹SubResT›, `owner`: T.Owner): *T.RpcInfo*
97
 ▸ **rpcToRpcinfo**<**SubResT**>(`rpc`: T.RPC‹SubResT›, `owner`: T.Owner): *T.RpcInfo*
98
 
98
 
99
-Defined in Utils.ts:8
99
+Defined in Utils.ts:13
100
+
101
+Translate an RPC to RPCInfo for serialization.
100
 
102
 
101
 **Type parameters:**
103
 **Type parameters:**
102
 
104
 
104
 
106
 
105
 **Parameters:**
107
 **Parameters:**
106
 
108
 
107
-Name | Type |
108
------- | ------ |
109
-`rpc` | T.RPC‹SubResT› |
110
-`owner` | T.Owner |
109
+Name | Type | Description |
110
+------ | ------ | ------ |
111
+`rpc` | T.RPC‹SubResT› | The RPC to transform |
112
+`owner` | T.Owner | The owning RPC group's name |
111
 
113
 
112
 **Returns:** *T.RpcInfo*
114
 **Returns:** *T.RpcInfo*

+ 6
- 1
src/Utils.ts View File

4
 import * as I from "./Interfaces";
4
 import * as I from "./Interfaces";
5
 import { SubscriptionResponse } from "./Types";
5
 import { SubscriptionResponse } from "./Types";
6
 
6
 
7
-
7
+/**
8
+ * Translate an RPC to RPCInfo for serialization.
9
+ * @param rpc The RPC to transform
10
+ * @param owner The owning RPC group's name
11
+ * @throws Error on RPC without name property
12
+ */
8
 export const rpcToRpcinfo = <SubResT = {}>(rpc : T.RPC<SubResT>, owner: T.Owner):T.RpcInfo => {
13
 export const rpcToRpcinfo = <SubResT = {}>(rpc : T.RPC<SubResT>, owner: T.Owner):T.RpcInfo => {
9
     switch (typeof rpc){
14
     switch (typeof rpc){
10
         case  "object":
15
         case  "object":

Loading…
Cancel
Save