2022-10-03 13:44:41 +02:00
|
|
|
const { ipcRenderer, dialog } = require('electron');
|
2022-09-20 19:14:04 +02:00
|
|
|
|
|
|
|
ipcRenderer.on("download complete", (event, file) => {
|
|
|
|
console.log(file); // Full file path
|
2022-10-03 13:44:41 +02:00
|
|
|
// Datei entpacken
|
2022-09-20 19:14:04 +02:00
|
|
|
});
|
2022-10-03 13:44:41 +02:00
|
|
|
|
2022-09-20 19:14:04 +02:00
|
|
|
ipcRenderer.on("download progress", (event, progress) => {
|
2022-10-03 13:44:41 +02:00
|
|
|
const cleanProgressInPercentages = Math.floor(progress.percent * 100); // Without decimal point
|
|
|
|
document.getElementById('progressbar').value = cleanProgressInPercentages;
|
2022-09-21 18:25:29 +02:00
|
|
|
});
|
|
|
|
|
2022-10-03 13:44:41 +02:00
|
|
|
let donwloadbtn = document.getElementById('download');
|
|
|
|
donwloadbtn.addEventListener('click', (e) => {
|
|
|
|
let directoryPath = document.getElementById('dirBox');
|
|
|
|
let urlPath = document.getElementById('urlBox');
|
|
|
|
ipcRenderer.send("download", {
|
|
|
|
url: urlPath.value,
|
|
|
|
properties: { directory: directoryPath.value }
|
|
|
|
});
|
2022-10-02 21:35:42 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
|
2022-10-03 13:44:41 +02:00
|
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
|
|
document.getElementById('dirs').addEventListener('click', function() {
|
|
|
|
openFile();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
function openFile() {
|
|
|
|
ipcRenderer.send('openFolder', () => {
|
|
|
|
console.log("Event sent.");
|
|
|
|
});
|
|
|
|
}
|
2022-10-02 21:35:42 +02:00
|
|
|
|
2022-10-03 13:44:41 +02:00
|
|
|
ipcRenderer.on('folderData', (event, data) => {
|
|
|
|
console.log(data)
|
|
|
|
})
|