From: Robo Date: Mon, 28 Sep 2015 07:22:50 +0000 (+0530) Subject: add examples X-Git-Tag: v0.33.4~14^2 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=db0732b35be691081ced67c219cb783e9ab2330a;p=electron.git add examples --- diff --git a/docs/api/session.md b/docs/api/session.md index 36a92f29..392b6826 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