]> khamidou — GitHub mirrors - electron.git/commitdiff
docs: Small changes to will-download event
authorCheng Zhao <zcbenz@gmail.com>
Tue, 1 Sep 2015 12:16:28 +0000 (20:16 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Tue, 1 Sep 2015 12:16:28 +0000 (20:16 +0800)
docs/api/session.md

index 28a0c92ca655ed69b0e96d1529b6a084bedea624..439cf8514e9375a7e4ac2c10d88930ec9dc0e8b4 100644 (file)
@@ -18,20 +18,21 @@ var session = win.webContents.session
 ### Event: 'will-download'
 
 * `event` Event
-* `downloadItem` Object
+* `item` Object
   * `url` String
   * `filename` String
   * `mimeType` String
   * `hasUserGesture` Boolean
-* `webContents` (WebContents)[web-contents.md]
+* `webContents` [WebContents](web-contents.md)
 
-Fired when a download is about to start. Calling `preventDefault()`
-will cancel the download.
+Fired when Electron is about to download `item` in `webContents`.
+
+Calling `event.preventDefault()` will cancel the download.
 
 ```javascript
-session.on('will-download', function(e, downloadItem, webContents) {
-  e.preventDefault();
-  require('request')(downloadItem.url, function(data) {
+session.on('will-download', function(event, item, webContents) {
+  event.preventDefault();
+  require('request')(item.url, function(data) {
     require('fs').writeFileSync('/somewhere', data);
   });
 });