Kaynağa Gözat

bump

master
peter 5 yıl önce
ebeveyn
işleme
ac9e6d3732
5 değiştirilmiş dosya ile 10 ekleme ve 10 silme
  1. 1
    1
      package.json
  2. 1
    1
      src/Backend.ts
  3. 4
    4
      src/Types.ts
  4. 1
    1
      src/Utils.ts
  5. 3
    3
      test/TestBackend.ts

+ 1
- 1
package.json Dosyayı Görüntüle

@@ -1,6 +1,6 @@
1 1
 {
2 2
   "name": "rpclibrary",
3
-  "version": "1.0.4",
3
+  "version": "1.1.0",
4 4
   "description": "",
5 5
   "main": "./js/Index.js",
6 6
   "scripts": {

+ 1
- 1
src/Backend.ts Dosyayı Görüntüle

@@ -46,7 +46,7 @@ export class RPCServer<
46 46
         if(badRPC = exporters.flatMap(ex => ex.exportRPCs()).find(rpc => !rpc.name))
47 47
         throw new Error(`
48 48
             RPC did not provide a name. 
49
-            \nUse funtion name(..){ .. } syntax instead.
49
+            \nUse 'funtion name(..){ .. }' syntax instead.
50 50
             \n
51 51
             \n<------------OFFENDING RPC:
52 52
             \n`+badRPC.toString()+`

+ 4
- 4
src/Types.ts Dosyayı Görüntüle

@@ -48,7 +48,7 @@ export type BaseInfo = {
48 48
 
49 49
 export type HookInfo<T = {}> = BaseInfo & { 
50 50
     type: 'Hook', 
51
-    generator: (socket) => HookFunction<T>
51
+    generator: (socket?:I.Socket) => HookFunction<T>
52 52
 }
53 53
 
54 54
 export type CallInfo = BaseInfo & {
@@ -61,6 +61,6 @@ export type ExtendedRpcInfo = RpcInfo & { uniqueName: string }
61 61
 
62 62
 export type OnFunction = (type: 'error' | 'close', f: (e?:any)=>void) => I.Socket
63 63
 export type HookCloseFunction<T = {}> = (res:SubscriptionResponse<T>, rpc:HookRPC<T>) => any
64
-export type HookFunction<T = {}> = (...args:[any, ...any[]]) => Promise<SubscriptionResponse<T> | ErrorResponse>
65
-export type AsyncFunction = (...args:any[]) => Promise<any>
66
-export type CallbackFunction = (...args:any[]) => void
64
+export type HookFunction<T = {}> = (...args:any) => Promise<SubscriptionResponse<T> | ErrorResponse>
65
+export type AsyncFunction = (...args:any) => Promise<any>
66
+export type CallbackFunction = (...args:any) => void

+ 1
- 1
src/Utils.ts Dosyayı Görüntüle

@@ -28,7 +28,7 @@ export const rpcToRpcinfo = <SubResT = {}>(rpc : T.RPC<SubResT>, owner: T.Owner)
28 28
         case "function":
29 29
             if(!rpc.name) throw new Error(`
30 30
 RPC did not provide a name. 
31
-\nUse funtion name(..){ .. } syntax instead.
31
+\nUse 'funtion name(..){ .. }' syntax instead.
32 32
 \n
33 33
 \n<------------OFFENDING RPC:
34 34
 \n`+rpc.toString()+`

+ 3
- 3
test/TestBackend.ts Dosyayı Görüntüle

@@ -24,18 +24,18 @@ new RPCServer(20000, [{
24 24
                 subcallback = callback
25 25
                 return makeSubResponse()
26 26
             },
27
-            onClose: (res:SubscriptionResponse, rpc:HookRPC) => { 
27
+            onClose: (res, rpc) => { 
28 28
                 console.log("Specific close handler for", rpc.name, res)
29 29
                 subcallback = null 
30 30
             },
31
-            onCallback: (...args:any) => { console.log.apply(console, args) }
31
+            onCallback: (...args) => { console.log.apply(console, args) }
32 32
         },
33 33
         function add(...args:number[]):number {return args.reduce((a,b)=>a+b, 0)},
34 34
         function triggerCallback(...messages:any[]):number {return subcallback.apply({}, messages)},
35 35
     ]
36 36
 }])
37 37
 
38
-new RPCServer<{ topic: string}>(20001, [{
38
+new RPCServer<{ topic: string }>(20001, [{
39 39
     name: "HelloWorldRPCGroup",
40 40
     exportRPCs: () => [
41 41
         {

Loading…
İptal
Kaydet