У меня есть приложение, которое должно загружать несколько файлов параллельно, и проблема заключается в том, что когда я начинаю загружать эти файлы с помощью метода downloadURL
, мой пользовательский интерфейс получает блокировку до конца загрузки.
this.win.webContents.downloadURL(this.url);
this.win.webContents.session.on("will-download", (event, item) => {
item.setSavePath(this.filePath.substr(0,
this.filePath.lastIndexOf("\\")) + `\\${item.getFilename()}`);
item.on("done", (event, state) => {
if (state === 'completed') {
this.win.webContents.send(IpcCodes.downloadImgComplete, {
filePath: this.filePath,
path: item.getSavePath()
})
}
})
})