@@ -10,20 +10,25 @@ export class ProgressComponent implements OnDestroy {
1010 dynamic : number ;
1111 type : string ;
1212
13+ stacked : any [ ] = [ ] ;
14+
15+ timer : any = null ;
16+ buttonCaption : string = 'Start' ;
17+
1318 constructor ( ) {
1419 this . random ( ) ;
15- this . randomStacked ( )
20+ this . randomStacked ( ) ;
1621 }
1722
1823 ngOnDestroy ( ) {
1924 if ( this . timer ) {
20- clearInterval ( this . timer )
25+ clearInterval ( this . timer ) ;
2126 }
2227 // console.log(`onDestroy`, this.timer);
2328 }
2429
2530 random ( ) : void {
26- let value = Math . floor ( Math . random ( ) * 100 + 1 ) ;
31+ const value = Math . floor ( Math . random ( ) * 100 + 1 ) ;
2732 let type : string ;
2833
2934 if ( value < 25 ) {
@@ -42,16 +47,14 @@ export class ProgressComponent implements OnDestroy {
4247
4348 }
4449
45- stacked : any [ ] = [ ] ;
46-
4750 randomStacked ( ) : void {
48- let types = [ 'success' , 'info' , 'warning' , 'danger' ] ;
51+ const types = [ 'success' , 'info' , 'warning' , 'danger' ] ;
4952
5053 this . stacked = [ ] ;
51- let n = Math . floor ( Math . random ( ) * 4 + 1 ) ;
54+ const n = Math . floor ( Math . random ( ) * 4 + 1 ) ;
5255 for ( let i = 0 ; i < n ; i ++ ) {
53- let index = Math . floor ( Math . random ( ) * 4 ) ;
54- let value = Math . floor ( Math . random ( ) * 27 + 3 ) ;
56+ const index = Math . floor ( Math . random ( ) * 4 ) ;
57+ const value = Math . floor ( Math . random ( ) * 27 + 3 ) ;
5558 this . stacked . push ( {
5659 value,
5760 type : types [ index ] ,
@@ -60,9 +63,6 @@ export class ProgressComponent implements OnDestroy {
6063 }
6164 }
6265
63- timer : any = null ;
64- buttonCaption : string = 'Start' ;
65-
6666 randomize ( ) : void {
6767 if ( this . timer ) {
6868 clearInterval ( this . timer ) ;
0 commit comments