|
@@ -37,15 +37,20 @@ win.webContents.session.on('will-download', (event, item, webContents) => {
|
|
|
|
|
|
### 事件: 'updated'
|
|
|
|
|
|
-当`downloadItem`获得更新时触发。
|
|
|
+* `event` Event
|
|
|
+* `state` String
|
|
|
+ * `progressing` - 下载中。
|
|
|
+ * `interrupted` - 下载被中断且可恢复。
|
|
|
+
|
|
|
+当`downloadItem`获得更新且未终止时触发。
|
|
|
|
|
|
### 事件: 'done'
|
|
|
|
|
|
* `event` Event
|
|
|
* `state` String
|
|
|
- * `completed` - 下载成功完成。
|
|
|
+ * `completed` - 下载成功。
|
|
|
* `cancelled` - 下载被取消。
|
|
|
- * `interrupted` - 与文件服务器错误的中断连接。
|
|
|
+ * `interrupted` - 下载被中断且不可恢复。
|
|
|
|
|
|
当下载处于一个终止状态时触发。这包括了一个完成的下载,一个被取消的下载(via `downloadItem.cancel()`),
|
|
|
和一个被意外中断的下载(无法恢复)。
|
|
@@ -65,10 +70,18 @@ win.webContents.session.on('will-download', (event, item, webContents) => {
|
|
|
|
|
|
暂停下载。
|
|
|
|
|
|
+### `downloadItem.isPause()`
|
|
|
+
|
|
|
+返回一个`Boolean`表示是否暂定下载。
|
|
|
+
|
|
|
### `downloadItem.resume()`
|
|
|
|
|
|
恢复被暂停的下载。
|
|
|
|
|
|
+### `downloadItem.canResume()`
|
|
|
+
|
|
|
+返回一个`Boolean`表示是否可以恢复被暂停的下载。
|
|
|
+
|
|
|
### `downloadItem.cancel()`
|
|
|
|
|
|
取消下载操作。
|
|
@@ -103,3 +116,12 @@ win.webContents.session.on('will-download', (event, item, webContents) => {
|
|
|
### `downloadItem.getContentDisposition()`
|
|
|
|
|
|
以`String`形式返回响应头(response header)中的`Content-Disposition`域。
|
|
|
+
|
|
|
+### `downloadItem.getState()`
|
|
|
+
|
|
|
+以`String`形式返回该下载项的目前状态。
|
|
|
+
|
|
|
+* `progressing` - 下载中。
|
|
|
+* `completed` - 下载成功。
|
|
|
+* `cancelled` - 下载被取消。
|
|
|
+* `interrupted` - 下载被中断。
|