Skip to content

Commit

Permalink
chore(docs): Updated blockAllRequestsInProgress docs
Browse files Browse the repository at this point in the history
  • Loading branch information
kuuurt13 committed May 19, 2020
1 parent 7733881 commit a01d51c
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions docs/http-module.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# Router Module

## Automatically Block HTTP Requests

This module allows for blocking automatically during all HTTP requests made with the `HttpClient`

### Setup

The core `BlockUIModule` should first be imported within the app. Once added, a seperate module called `BlockUIHttpModule` should then be imported to allow for HTTP blocking.

```ts
Expand All @@ -23,16 +25,19 @@ export class AppModule {}
```

### Setting: `requestFilters`

Accepts an array of requests to be filtered out from being blocked.

**Types**

```
requestFilters: (RegExp | { method: string, url: RegExp } | Function)[]
```

_Note: If using RegExp with AOT compiling, please see this [Stack Overflow Post](https://stackoverflow.com/questions/48751006/ng-build-gives-an-error-because-of-regexp)._

#### Type: `RegExp`

Filter requests by URL

Below will filter out blocking for any requests containing `api.github.com/users/` in the URL.
Expand All @@ -51,6 +56,7 @@ export class AppModule {}
```

#### Type: `{ method: string, url: RegExp }`

Filter requests by http method and URL

Below will filter out blocking for any requests with a `POST` method and a URL containing `api.github.com/users/`
Expand All @@ -72,6 +78,7 @@ export class AppModule {}
```

#### Type: `Function`

Filter requests by passing a function. The function will be passed the current request and if `true` is returned the request will not be blocked.

Below will filter out all requests with a query parameter of `foo=bar`.
Expand All @@ -94,8 +101,9 @@ export class AppModule {}
```

### Setting: `blockAllRequestsInProgress`
Accepts a boolean. If set to `true`, it deactivates the BlockUI only once the last httpRequest has been processed in case of parallel requests.

Defaulted to `false`.
If set to `false`, when multiple http requests are fired off blocking will stop when the first request resolves instead of waiting for all requests to resolve.

Defaulted to `true`.

#### Type: `boolean`
#### Type: `boolean`

0 comments on commit a01d51c

Please sign in to comment.