From db0732b35be691081ced67c219cb783e9ab2330a Mon Sep 17 00:00:00 2001 From: Robo Date: Mon, 28 Sep 2015 12:52:50 +0530 Subject: [PATCH] add examples --- docs/api/session.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/docs/api/session.md b/docs/api/session.md index 36a92f296e7f..392b6826414d 100644 --- a/docs/api/session.md +++ b/docs/api/session.md @@ -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`. +```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` Disables any network emulation already active for the `session`. Resets to