Skip to content

Commit 4d62c91

Browse files
authored
Merge pull request #81 from mpalourdio/v3
V3 - remove deprecations & renaming
2 parents 367ac7c + 477c82c commit 4d62c91

15 files changed

+121
-159
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ node_js:
44
- lts/*
55
- node
66
script:
7+
- yarn lint
78
- yarn test --code-coverage
89
- yarn build
910

CHANGELOG.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Changelog
22

3+
## v3.0.0
4+
5+
- All existing deprecations have been removed.
6+
- BC breaks =>
7+
- ``SpinnerComponent`` has been renamed to ``NgHttpLoaderComponent``.
8+
- The ``<spinner>`` component-selector has been renamed to ``<ng-http-loader>``.
9+
310
## v2.3.0
411

512
This release adds the possibility to filter HTTP requests that should not be handled by the interceptor by providing an array of HTTP headers to the component's ``filteredHeaders`` property.
@@ -14,10 +21,10 @@ This release introduces the **minimum duration** option. It gives the possibilit
1421
You can mix this parameter with the **debounce delay** option:
1522

1623
```xml
17-
<spinner
24+
<ng-http-loader
1825
[debounceDelay]="100"
1926
[minDuration]="300">
20-
</spinner>
27+
</ng-http-loader>
2128
```
2229

2330
```

README.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ $ npm install ng-http-loader --save / yarn add ng-http-loader
2323

2424
## What does it do ?
2525

26-
This package provides an HTTP Interceptor, and a spinner component (All from [SpinKit](https://github.com/tobiasahlin/SpinKit) at the moment).
26+
This package provides an HTTP Interceptor, and some spinner components (All from [SpinKit](https://github.com/tobiasahlin/SpinKit) at the moment).
2727
The HTTP interceptor listens to all HTTP requests and shows a spinner / loader indicator during pending http requests.
2828

2929
## Angular 4 / Angular 5 / Angular 6
@@ -41,7 +41,7 @@ If you experience errors like below, **please double check the version you use.*
4141

4242
## Requirements - HttpClientModule
4343

44-
Performing http requests with the ``HttpClientModule`` API is **mandatory**. Otherwise,the spinner will not be fired **at all**.
44+
Performing http requests with the ``HttpClientModule`` API is **mandatory**. Otherwise, the spinner will not be fired **at all**.
4545

4646
See this [blog post](http://blog.ninja-squad.com/2017/07/17/http-client-module/) for an ``HttpClientModule`` introduction.
4747

@@ -74,19 +74,19 @@ export class AppModule { }
7474

7575
In your app.component.html, simply add:
7676
```xml
77-
<spinner></spinner>
77+
<ng-http-loader></ng-http-loader>
7878
```
7979

8080
## Customizing the spinner
8181

8282
You can customize the **background-color**, the **spinner type**, the **debounce delay** (ie. after how many milliseconds the spinner will be visible, if needed), the **minimum duration** (ie. how many milliseconds should the spinner be visible at least):
8383
```xml
84-
<spinner
84+
<ng-http-loader
8585
[backgroundColor]="'#ff0000'"
8686
[spinner]="spinkit.skWave"
8787
[debounceDelay]="100"
8888
[minDuration]="300">
89-
</spinner>
89+
</ng-http-loader>
9090
```
9191

9292
**_To use this syntax, you must reference the ``Spinkit`` const as a public property in your app.component.ts_**:
@@ -110,7 +110,7 @@ The different spinners available are referenced in [this class](src/lib/spinkits
110110
**_Otherwise, you can simply reference the chosen spinner as a simple string_**:
111111

112112
```xml
113-
<spinner backgroundColor="#ff0000" spinner="sk-wave"></spinner>
113+
<ng-http-loader backgroundColor="#ff0000" spinner="sk-wave"></ng-http-loader>
114114
```
115115

116116
## Defining your own spinner
@@ -120,9 +120,9 @@ You can define your own loader component in place of the built-in ones. The need
120120
- Create your component
121121
- Add it to the [entryComponent](https://angular.io/guide/ngmodule-faq#what-is-an-entry-component) definition in your module definition
122122
- Reference your component in a public property in your ``app.component.ts``
123-
- Reference the property in the spinner component like this:
123+
- Reference the property in the ng-http-loader component like this:
124124
```xml
125-
<spinner [entryComponent]="myAwesomeComponent"></spinner>
125+
<ng-http-loader [entryComponent]="myAwesomeComponent"></ng-http-loader>
126126
```
127127

128128
You can find some short examples [here](https://gist.github.com/mpalourdio/2c0bec03d610b24ff49db649fbb69a48) and [here](https://gist.github.com/mpalourdio/e05b4495de2abeeecfcf92d70e4ef93e).
@@ -131,22 +131,22 @@ You can find some short examples [here](https://gist.github.com/mpalourdio/2c0be
131131

132132
You can filter the http requests that shouldn't be caught by the interceptor by providing **an array of regex patterns**:
133133
```xml
134-
<spinner [filteredUrlPatterns]="['\\d', '[a-zA-Z]', 'my-api']"></spinner>
134+
<ng-http-loader [filteredUrlPatterns]="['\\d', '[a-zA-Z]', 'my-api']"></ng-http-loader>
135135
```
136136

137137
You can filter the http requests by providing **an array of HTTP methods** (case insensitive):
138138
```xml
139-
<spinner [filteredMethods]="['gEt', 'POST', 'PuT']"></spinner>
139+
<ng-http-loader [filteredMethods]="['gEt', 'POST', 'PuT']"></ng-http-loader>
140140
```
141141

142142
You can also filter the http requests by providing **an array of HTTP headers** (case insensitive):
143143
```xml
144-
<spinner [filteredHeaders]="['hEaDeR', 'AnoTheR-HeAdEr']"></spinner>
144+
<ng-http-loader [filteredHeaders]="['hEaDeR', 'AnoTheR-HeAdEr']"></ng-http-loader>
145145
```
146146

147147
## Manually show and hide the spinner
148148

149-
You can manually show and hide the spinner component if needed. You must use the ``SpinnerVisibilityService`` for this purpose.
149+
You can manually show and hide the spinner if needed. You must use the ``SpinnerVisibilityService`` for this purpose.
150150

151151
Sometimes, when manually showing the spinner, an http request could be performed in background, and when finished, the spinner would automagically disappear.
152152

angular.json

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,5 @@
4040
}
4141
}
4242
},
43-
"defaultProject": "ng-http-loader",
44-
"schematics": {
45-
"@schematics/angular:component": {
46-
"prefix": ""
47-
},
48-
"@schematics/angular:directive": {
49-
"prefix": ""
50-
}
51-
}
43+
"defaultProject": "ng-http-loader"
5244
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ng-http-loader",
3-
"version": "2.3.0",
3+
"version": "3.0.0",
44
"scripts": {
55
"ng": "ng",
66
"build": "ng build",
File renamed without changes.
File renamed without changes.

src/lib/components/spinner/spinner.component.ts renamed to src/lib/components/ng-http-loader.component.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,16 @@
1010
import { Component, Input, OnDestroy, OnInit } from '@angular/core';
1111
import { EMPTY, merge, Observable, Subscription, timer } from 'rxjs';
1212
import { debounce, delayWhen } from 'rxjs/operators';
13-
import { PendingInterceptorService } from '../../services/pending-interceptor.service';
14-
import { SpinnerVisibilityService } from '../../services/spinner-visibility.service';
15-
import { Spinkit } from '../../spinkits';
13+
import { PendingInterceptorService } from '../services/pending-interceptor.service';
14+
import { SpinnerVisibilityService } from '../services/spinner-visibility.service';
15+
import { Spinkit } from '../spinkits';
1616

1717
@Component({
18-
selector: 'spinner',
19-
templateUrl: './spinner.component.html',
20-
styleUrls: ['./spinner.component.css']
18+
selector: 'ng-http-loader',
19+
templateUrl: './ng-http-loader.component.html',
20+
styleUrls: ['./ng-http-loader.component.css']
2121
})
22-
export class SpinnerComponent implements OnDestroy, OnInit {
22+
export class NgHttpLoaderComponent implements OnDestroy, OnInit {
2323
public isSpinnerVisible: boolean;
2424
public spinkit = Spinkit;
2525
private subscriptions: Subscription;

src/lib/ng-http-loader.module.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,22 @@
1010
import { CommonModule } from '@angular/common';
1111
import { HttpClientModule } from '@angular/common/http';
1212
import { NgModule } from '@angular/core';
13-
import { SpinnerComponent } from './components/spinner/spinner.component';
13+
import { NgHttpLoaderComponent } from './components/ng-http-loader.component';
1414
import { PendingInterceptorServiceInterceptor } from './services/pending-interceptor.service';
1515
import { SPINKIT_COMPONENTS } from './spinkits';
1616

1717
@NgModule({
1818
declarations: [
19-
SpinnerComponent,
20-
SPINKIT_COMPONENTS,
19+
NgHttpLoaderComponent,
20+
...SPINKIT_COMPONENTS,
2121
],
2222
imports: [
2323
CommonModule,
2424
HttpClientModule,
2525
],
2626
exports: [
27-
SpinnerComponent,
28-
SPINKIT_COMPONENTS,
27+
NgHttpLoaderComponent,
28+
...SPINKIT_COMPONENTS,
2929
],
3030
providers: [
3131
PendingInterceptorServiceInterceptor,

src/lib/services/pending-interceptor.service.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,8 @@ export class PendingInterceptorService implements HttpInterceptor {
2323
private _filteredHeaders: string[] = [];
2424
private _forceByPass: boolean;
2525

26-
/** @deprecated Deprecated in favor of pendingRequestsStatus$ */
27-
get pendingRequestsStatus(): Observable<boolean> {
28-
return this._pendingRequestsStatus.asObservable();
29-
}
30-
3126
get pendingRequestsStatus$(): Observable<boolean> {
32-
return this.pendingRequestsStatus;
27+
return this._pendingRequestsStatus.asObservable();
3328
}
3429

3530
get pendingRequests(): number {

0 commit comments

Comments
 (0)