complete download-item translation docs

This commit is contained in:
dengyaolong 2017-02-08 12:38:08 +08:00
parent f9b319e4f8
commit 0748f4fef2

View file

@ -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` - 下载被中断。