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