37 lines
1.2 KiB
JavaScript
37 lines
1.2 KiB
JavaScript
function fadeIn() {
|
|
document.querySelector('.container').classList.remove('fade-out');
|
|
document.querySelector('.container').classList.add('fade-in');
|
|
}
|
|
|
|
function fadeOut(destination) {
|
|
const container = document.querySelector('.container');
|
|
container.classList.remove('fade-in');
|
|
container.classList.add('fade-out');
|
|
|
|
console.log(destination);
|
|
setTimeout(() => {}, 5000);
|
|
|
|
container.addEventListener('animationend', async () => {
|
|
try {
|
|
await window.electronAPI.changeContent(destination);
|
|
console.log('Navigated to', destination);
|
|
} catch (error) {
|
|
console.error('Error navigating:', error);
|
|
}
|
|
});
|
|
}
|
|
|
|
async function waitForResponse() {
|
|
return new Promise((resolve) => {
|
|
const idResponseCheck = setInterval(async () => {
|
|
const status = await window.electronAPI.hasResponseArrived();
|
|
if (status) {
|
|
clearInterval(idResponseCheck);
|
|
const response = await window.electronAPI.getLastUcResult();
|
|
resolve(response || null); // Resolve the response or null if not available
|
|
}
|
|
}, 100); // Check every 100 milliseconds if the response has arrived
|
|
});
|
|
}
|
|
|