浏览代码

declared callback types

Daniel Zlotin 6 年前
父节点
当前提交
5bc414affb
共有 1 个文件被更改,包括 7 次插入7 次删除
  1. 7
    7
      lib/src/events/EventsRegistry.ts

+ 7
- 7
lib/src/events/EventsRegistry.ts 查看文件

@@ -1,25 +1,25 @@
1
-import { EventSubscription } from '../adapters/NativeEventsReceiver';
1
+import { EventSubscription, NativeEventsReceiver } from '../adapters/NativeEventsReceiver';
2 2
 
3 3
 export class EventsRegistry {
4
-  private nativeEventsReceiver;
4
+  private nativeEventsReceiver: NativeEventsReceiver;
5 5
 
6
-  constructor(nativeEventsReceiver) {
6
+  constructor(nativeEventsReceiver: NativeEventsReceiver) {
7 7
     this.nativeEventsReceiver = nativeEventsReceiver;
8 8
   }
9 9
 
10
-  public appLaunched(callback): EventSubscription {
10
+  public appLaunched(callback: () => void): EventSubscription {
11 11
     return this.nativeEventsReceiver.registerAppLaunched(callback);
12 12
   }
13 13
 
14
-  public componentDidAppear(callback): EventSubscription {
14
+  public componentDidAppear(callback: (componendId: string, componentName: string) => void): EventSubscription {
15 15
     return this.nativeEventsReceiver.registerComponentDidAppear(callback);
16 16
   }
17 17
 
18
-  public componentDidDisappear(callback): EventSubscription {
18
+  public componentDidDisappear(callback: (componendId: string, componentName: string) => void): EventSubscription {
19 19
     return this.nativeEventsReceiver.registerComponentDidDisappear(callback);
20 20
   }
21 21
 
22
-  public interaction(callback): EventSubscription {
22
+  public interaction(callback: (name: string) => void): EventSubscription {
23 23
     return this.nativeEventsReceiver.registerInteraction(callback);
24 24
   }
25 25
 }