]> khamidou — GitHub mirrors - electron.git/commitdiff
add examples
authorRobo <hop2deep@gmail.com>
Mon, 28 Sep 2015 07:22:50 +0000 (12:52 +0530)
committerRobo <hop2deep@gmail.com>
Mon, 28 Sep 2015 07:22:50 +0000 (12:52 +0530)
docs/api/session.md

index 36a92f296e7f650fd30d41be43f62d4eaad8181a..392b6826414d73e15b2d54b2781d07b13124af5c 100644 (file)
@@ -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