A pretty basic electron question, explaining it by a specific example:
in my first electron app I want to change the innerHTML of a label before sync-copying a larger file.
here's what I wrongfully thought the solution is. with this code, the label text is changed after the file was copied:
renderer.js:
const lbl = document.getElementById('statusLabel')
lbl.innerHTML = "New Description"
fs.copyFileSync(...)
However, I can "force" first updating the label by this:
renderer.js:
const lbl = document.getElementById('statusLabel')
lbl.innerHTML = "New Description"
ipcRenderer.send('copyFile')
main.js:
ipcMain.on('copyFile', () => {
ipcMain.send('copyFile'))
}
I could replace fs.copyFileSync with any other function - the point is, I only get it to work in the required order by sending the subsequent action to the renderer.
is this intended electron behaviour or did I miss something basic?