@@ -9,19 +9,27 @@ export type ListCallback<T extends KubernetesObject> = (list: T[], ResourceVersi
9
9
export type ListPromise < T extends KubernetesObject > = ( ) => Promise < KubernetesListObject < T > > ;
10
10
11
11
// These are issued per object
12
- export const ADD : string = 'add' ;
13
- export const UPDATE : string = 'update' ;
14
- export const CHANGE : string = 'change' ;
15
- export const DELETE : string = 'delete' ;
12
+ export const ADD = 'add' ;
13
+ export type ADD = typeof ADD ;
14
+ export const UPDATE = 'update' ;
15
+ export type UPDATE = typeof UPDATE ;
16
+ export const CHANGE = 'change' ;
17
+ export type CHANGE = typeof CHANGE ;
18
+ export const DELETE = 'delete' ;
19
+ export type DELETE = typeof DELETE ;
16
20
17
21
// This is issued when a watch connects or reconnects
18
- export const CONNECT : string = 'connect' ;
22
+ export const CONNECT = 'connect' ;
23
+ export type CONNECT = typeof CONNECT ;
19
24
// This is issued when there is an error
20
- export const ERROR : string = 'error' ;
25
+ export const ERROR = 'error' ;
26
+ export type ERROR = typeof ERROR ;
21
27
22
28
export interface Informer < T extends KubernetesObject > {
23
- on ( verb : string , fn : ObjectCallback < T > ) : void ;
24
- off ( verb : string , fn : ObjectCallback < T > ) : void ;
29
+ on ( verb : ADD | UPDATE | DELETE | CHANGE , cb : ObjectCallback < T > ) : void ;
30
+ on ( verb : ERROR | CONNECT , cb : ErrorCallback ) : void ;
31
+ off ( verb : ADD | UPDATE | DELETE | CHANGE , cb : ObjectCallback < T > ) : void ;
32
+ off ( verb : ERROR | CONNECT , cb : ErrorCallback ) : void ;
25
33
start ( ) : Promise < void > ;
26
34
stop ( ) : Promise < void > ;
27
35
}
0 commit comments