Browse Source

declared callback types

Daniel Zlotin 6 years ago
parent
commit
5bc414affb
1 changed files with 7 additions and 7 deletions
  1. 7
    7
      lib/src/events/EventsRegistry.ts

+ 7
- 7
lib/src/events/EventsRegistry.ts View File

1
-import { EventSubscription } from '../adapters/NativeEventsReceiver';
1
+import { EventSubscription, NativeEventsReceiver } from '../adapters/NativeEventsReceiver';
2
 
2
 
3
 export class EventsRegistry {
3
 export class EventsRegistry {
4
-  private nativeEventsReceiver;
4
+  private nativeEventsReceiver: NativeEventsReceiver;
5
 
5
 
6
-  constructor(nativeEventsReceiver) {
6
+  constructor(nativeEventsReceiver: NativeEventsReceiver) {
7
     this.nativeEventsReceiver = nativeEventsReceiver;
7
     this.nativeEventsReceiver = nativeEventsReceiver;
8
   }
8
   }
9
 
9
 
10
-  public appLaunched(callback): EventSubscription {
10
+  public appLaunched(callback: () => void): EventSubscription {
11
     return this.nativeEventsReceiver.registerAppLaunched(callback);
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
     return this.nativeEventsReceiver.registerComponentDidAppear(callback);
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
     return this.nativeEventsReceiver.registerComponentDidDisappear(callback);
19
     return this.nativeEventsReceiver.registerComponentDidDisappear(callback);
20
   }
20
   }
21
 
21
 
22
-  public interaction(callback): EventSubscription {
22
+  public interaction(callback: (name: string) => void): EventSubscription {
23
     return this.nativeEventsReceiver.registerInteraction(callback);
23
     return this.nativeEventsReceiver.registerInteraction(callback);
24
   }
24
   }
25
 }
25
 }