refactor: make savePath a property on DownloadItem (#18677)

This commit is contained in:
Shelley Vohr 2019-06-20 10:04:57 -07:00 committed by GitHub
parent e95d2129be
commit 536327151d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 30 additions and 15 deletions

View file

@ -80,7 +80,9 @@ The `downloadItem` object has the following methods:
The API is only available in session's `will-download` callback function.
If user doesn't set the save path via the API, Electron will use the original
routine to determine the save path(Usually prompts a save dialog).
routine to determine the save path; this usually prompts a save dialog.
**[Deprecated](modernization/property-updates.md): use the `savePath` property instead.**
#### `downloadItem.getSavePath()`
@ -88,6 +90,8 @@ Returns `String` - The save path of the download item. This will be either the p
set via `downloadItem.setSavePath(path)` or the path selected from the shown
save dialog.
**[Deprecated](modernization/property-updates.md): use the `savePath` property instead.**
#### `downloadItem.setSaveDialogOptions(options)`
* `options` SaveDialogOptions - Set the save file dialog options. This object has the same
@ -181,3 +185,13 @@ Returns `String` - ETag header value.
Returns `Double` - Number of seconds since the UNIX epoch when the download was
started.
### Instance Properties
#### `downloadItem.savePath`
A `String` property that determines the save file path of the download item.
The property is only available in session's `will-download` callback function.
If user doesn't set the save path via the property, Electron will use the original
routine to determine the save path; this usually prompts a save dialog.

View file

@ -20,9 +20,6 @@ The Electron team is currently undergoing an initiative to convert separate gett
* `visibleOnAllWorkspaces`
* `crashReporter` module
* `uploadToServer`
* `DownloadItem` class
* `savePath`
* `paused`
* `Session` module
* `preloads`
* `webContents` module
@ -47,6 +44,8 @@ The Electron team is currently undergoing an initiative to convert separate gett
* `applicationMenu`
* `badgeCount`
* `name`
* `DownloadItem` class
* `savePath`
* `BrowserWindow` module
* `autohideMenuBar`
* `resizable`