2022-09-20 19:14:04 +02:00
|
|
|
// Buttons
|
|
|
|
const startDownload = document.querySelector('startDownload');
|
|
|
|
const stopDownload = document.querySelector('stopDownload');
|
|
|
|
const startUnzip = document.querySelector('startUnzip');
|
|
|
|
const stopUnzip = document.querySelector('stopUnzip');
|
|
|
|
const selectVersionBtn = document.querySelector('selectVersion');
|
|
|
|
const selectPathBtn = document.querySelector('selectPathBtn');
|
2022-09-25 10:12:02 +02:00
|
|
|
const writeFile = document.querySelector('writeFile');
|
2022-09-20 19:14:04 +02:00
|
|
|
|
2022-09-25 10:12:02 +02:00
|
|
|
const { remote, ipcRenderer } = require('electron');
|
2022-09-20 19:14:04 +02:00
|
|
|
const { writeFile } = require('fs');
|
|
|
|
|
2022-10-02 21:35:42 +02:00
|
|
|
document.getElementById('btn').addEventListener('click', () => {
|
|
|
|
const filePath = window.electronAPI.openFile()
|
|
|
|
document.getElementById('filePath').innerText = filePath
|
|
|
|
});
|
|
|
|
|
2022-09-20 19:14:04 +02:00
|
|
|
|
|
|
|
ipcRenderer.on("download complete", (event, file) => {
|
|
|
|
console.log(file); // Full file path
|
|
|
|
});
|
|
|
|
ipcRenderer.on("download progress", (event, progress) => {
|
|
|
|
console.log(progress); // Progress in fraction, between 0 and 1
|
|
|
|
const progressInPercentages = progress * 100; // With decimal point and a bunch of numbers
|
|
|
|
const cleanProgressInPercentages = Math.floor(progress * 100); // Without decimal point
|
2022-09-21 18:25:29 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
// Select Folder
|
|
|
|
document.getElementById('dirs').addEventListener('click', (evt) => {
|
|
|
|
evt.preventDefault()
|
|
|
|
window.postMessage({
|
|
|
|
type: 'select-dirs',
|
|
|
|
})
|
2022-10-02 21:35:42 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
document.getElementById('openButton').addEventListener('click', () => {
|
|
|
|
console.log("Test");
|
|
|
|
ipcRenderer.send('openFile', {})
|
2022-09-25 10:12:02 +02:00
|
|
|
});
|