Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
Adding docs for withExtraHeadRequest param
  • Loading branch information
Raúl Gómez Acuña committed Oct 10, 2017
1 parent 7631e7a commit f016c01
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions README.md
Expand Up @@ -64,7 +64,8 @@ withNetworkConnectivity(config: Config): (WrappedComponent) => EnhancedComponent
type Config = {
withRedux?: boolean = false,
timeout?: number = 3000,
pingServerUrl?: string = 'https://google.com'
pingServerUrl?: string = 'https://google.com',
withExtraHeadRequest?: boolean = true,
}
```

Expand All @@ -75,6 +76,8 @@ type Config = {

`pingServerUrl`: remote server to ping to. It defaults to https://google.com since it's probably one the most stable servers out there, but you can provide your own if needed.

`withExtraHeadRequest`: flag that denotes whether the extra ping check will be performed or not. Defaults to `true`.

##### Usage
```js
import React from 'react';
Expand All @@ -89,14 +92,15 @@ export default withNetworkConnectivity()(YourComponent);
```

#### `ConnectivityRenderer`
React component that accepts a function as children. It allows you to decouple your parent component and your child component, managing connectivity state on behalf of the components it is composed with, without making demands on how that state is leveraged by its children. Useful for conditionally render different children based on connectivity status. `timeout` and `pingServerUrl` can be provided through props in this case.
React component that accepts a function as children. It allows you to decouple your parent component and your child component, managing connectivity state on behalf of the components it is composed with, without making demands on how that state is leveraged by its children. Useful for conditionally render different children based on connectivity status. `timeout`, `pingServerUrl` and `withExtraHeadRequest` can be provided through props in this case.

##### Props
```js
type Props = {
children: (isConnected: boolean) => React$Element<any>
timeout?: number,
pingServerUrl?: string
timeout?: number = 3000,
pingServerUrl?: string = 'https://google.com',
withExtraHeadRequest?: boolean = true,
}
```

Expand Down

0 comments on commit f016c01

Please sign in to comment.