@@ -5,25 +5,25 @@ kc.loadFromDefault();
55
66const watch = new k8s . Watch ( kc ) ;
77const req = watch . watch ( '/api/v1/namespaces' ,
8- // optional query parameters can go here.
9- { } ,
10- // callback is called for each received object.
11- ( type , obj ) => {
12- if ( type === 'ADDED' ) {
13- console . log ( 'new object:' ) ;
14- } else if ( type === 'MODIFIED' ) {
15- console . log ( 'changed object:' ) ;
16- } else if ( type === 'DELETED' ) {
17- console . log ( 'deleted object:' ) ;
18- } else {
19- console . log ( 'unknown type: ' + type ) ;
20- }
21- console . log ( obj ) ;
22- } ,
23- // done callback is called if the watch terminates normally
24- ( err ) => {
25- console . error ( err ) ;
26- } ) ;
8+ // optional query parameters can go here.
9+ { } ,
10+ // callback is called for each received object.
11+ ( type , obj ) => {
12+ if ( type === 'ADDED' ) {
13+ console . log ( 'new object:' ) ;
14+ } else if ( type === 'MODIFIED' ) {
15+ console . log ( 'changed object:' ) ;
16+ } else if ( type === 'DELETED' ) {
17+ console . log ( 'deleted object:' ) ;
18+ } else {
19+ console . log ( 'unknown type: ' + type ) ;
20+ }
21+ console . log ( obj ) ;
22+ } ,
23+ // done callback is called if the watch terminates normally
24+ ( err ) => {
25+ console . error ( err ) ;
26+ } ) ;
2727
2828// watch returns a request object which you can use to abort the watch.
2929setTimeout ( ( ) => { req . abort ( ) ; } , 10 * 1000 ) ;
0 commit comments