@@ -22,11 +22,11 @@ import { Spinkit } from '../spinkits';
2222export class NgHttpLoaderComponent implements OnInit {
2323
2424 public spinkit = Spinkit ;
25- public isVisible$ : Observable < boolean > ;
25+ public isVisible$ ! : Observable < boolean > ;
2626 private visibleUntil = Date . now ( ) ;
2727
2828 @Input ( ) public backdrop = true ;
29- @Input ( ) public backgroundColor : string ;
29+ @Input ( ) public backgroundColor ! : string ;
3030 @Input ( ) public debounceDelay = 0 ;
3131 @Input ( ) public entryComponent : any = null ;
3232 @Input ( ) public extraDuration = 0 ;
@@ -35,11 +35,17 @@ export class NgHttpLoaderComponent implements OnInit {
3535 @Input ( ) public filteredUrlPatterns : string [ ] = [ ] ;
3636 @Input ( ) public minDuration = 0 ;
3737 @Input ( ) public opacity = '.7' ;
38- @Input ( ) public spinner = Spinkit . skWave ;
38+ @Input ( ) public spinner : string | null = Spinkit . skWave ;
3939
4040 constructor ( private pendingRequestsInterceptor : PendingRequestsInterceptor , private spinnerVisibility : SpinnerVisibilityService ) {
4141 }
4242
43+ public ngOnInit ( ) : void {
44+ this . initIsvisibleObservable ( ) ;
45+ this . nullifySpinnerIfEntryComponentIsDefined ( ) ;
46+ this . initFilters ( ) ;
47+ }
48+
4349 private initIsvisibleObservable ( ) : void {
4450 const [ showSpinner$ , hideSpinner$ ] = partition ( this . pendingRequestsInterceptor . pendingRequestsStatus$ , h => h ) ;
4551
@@ -55,12 +61,6 @@ export class NgHttpLoaderComponent implements OnInit {
5561 ) ;
5662 }
5763
58- public ngOnInit ( ) : void {
59- this . initIsvisibleObservable ( ) ;
60- this . nullifySpinnerIfEntryComponentIsDefined ( ) ;
61- this . initFilters ( ) ;
62- }
63-
6464 private nullifySpinnerIfEntryComponentIsDefined ( ) : void {
6565 if ( this . entryComponent ) {
6666 this . spinner = null ;
@@ -74,10 +74,6 @@ export class NgHttpLoaderComponent implements OnInit {
7474 }
7575
7676 private initFilteredUrlPatterns ( ) : void {
77- if ( ! ( this . filteredUrlPatterns instanceof Array ) ) {
78- throw new TypeError ( '`filteredUrlPatterns` must be an array.' ) ;
79- }
80-
8177 if ( ! ! this . filteredUrlPatterns . length ) {
8278 this . filteredUrlPatterns . forEach ( e =>
8379 this . pendingRequestsInterceptor . filteredUrlPatterns . push ( new RegExp ( e ) )
@@ -86,16 +82,10 @@ export class NgHttpLoaderComponent implements OnInit {
8682 }
8783
8884 private initFilteredMethods ( ) : void {
89- if ( ! ( this . filteredMethods instanceof Array ) ) {
90- throw new TypeError ( '`filteredMethods` must be an array.' ) ;
91- }
9285 this . pendingRequestsInterceptor . filteredMethods = this . filteredMethods ;
9386 }
9487
9588 private initFilteredHeaders ( ) : void {
96- if ( ! ( this . filteredHeaders instanceof Array ) ) {
97- throw new TypeError ( '`filteredHeaders` must be an array.' ) ;
98- }
9989 this . pendingRequestsInterceptor . filteredHeaders = this . filteredHeaders ;
10090 }
10191
0 commit comments