add examples
This commit is contained in:
parent
442c79abe0
commit
db0732b35b
1 changed files with 12 additions and 0 deletions
|
@ -202,6 +202,18 @@ Sets download saving directory. By default, the download directory will be the
|
||||||
|
|
||||||
Emulates network with the given configuration for the `session`.
|
Emulates network with the given configuration for the `session`.
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
// To emulate a GPRS connection with 50kbps throughput and 500 ms latency.
|
||||||
|
window.webContents.session.enableNetworkEmulation({
|
||||||
|
latency: 500,
|
||||||
|
downloadThroughput: 6400,
|
||||||
|
uploadThroughput: 6400
|
||||||
|
});
|
||||||
|
|
||||||
|
// To emulate a network outage.
|
||||||
|
window.webContents.session.enableNetworkEmulation({offline: true});
|
||||||
|
```
|
||||||
|
|
||||||
### `session.disableNetworkEmulation`
|
### `session.disableNetworkEmulation`
|
||||||
|
|
||||||
Disables any network emulation already active for the `session`. Resets to
|
Disables any network emulation already active for the `session`. Resets to
|
||||||
|
|
Loading…
Add table
Reference in a new issue