#Help error npm start
1 messages · Page 1 of 1 (latest)
Code pls
In my index.js
You have to get the ipcMain class from electron. So add ipcMain to your require statement
you don't require ipcMain...
and in my update.html :
<script>
const { ipcRenderer } = require('electron');
const version = document.getElementById('version');
ipcRenderer.send('app_version');
ipcRenderer.on('app_version', (event, arg) => {
ipcRenderer.removeAllListeners('app_version');
version.innerText = 'Version ' + arg.version;
});
const notification = document.getElementById('notification');
const message = document.getElementById('message');
const restartButton = document.getElementById('restart-button');
ipcRenderer.on('update_available', () => {
ipcRenderer.removeAllListeners('update_available');
message.innerText = 'A new update is available. Downloading now...';
notification.classList.remove('hidden');
});
ipcRenderer.on('update_downloaded', () => {
ipcRenderer.removeAllListeners('update_downloaded');
message.innerText = 'Update Downloaded. It will be installed on restart. Restart now?';
restartButton.classList.remove('hidden');
notification.classList.remove('hidden');
});
function closeNotification() {
notification.classList.add('hidden');
}
function restartApp() {
ipcRenderer.send('restart_app');
}
</script>
Ohh.... like this const ipc = electron.ipcMain ?
Oh okay 😅
That would end in an error aswell, the way you set it up. @nova wing wrote what you need to do
Okay thanks 👌