Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
I´d like to show a progressbar inside my Electron App while an update gets downloaded. So, I´ve adjusted the example code from the electron-builder updater docs to my needs.
The following is an excerpt from my main.ts:
function sendStatusToWindow(updateState: UpdateState) {
log.info(updateState);
win.webContents.send('message', updateState);
autoUpdater.on('checking-for-update', () => {
sendStatusToWindow({ status: 'checking' });
autoUpdater.on('update-available', (info) => {
sendStatusToWindow({ status: 'update-available' });
autoUpdater.on('update-not-available', (info) => {
sendStatusToWindow({ status: 'current' });
autoUpdater.on('error', (err) => {
sendStatusToWindow({ status: 'error', error: err });
autoUpdater.on('download-progress', (progressObj) => {
log.info(progressObj);
sendStatusToWindow({
status: 'downloading',
download: {
bytesPerSecond: progressObj.bytesPerSecond,
percent: progressObj.percent,
transferred: progressObj.transferred,
total: progressObj.total
autoUpdater.on('update-downloaded', (info) => {
sendStatusToWindow({ status: 'completed' });
And my electron-builder.json:
"win": {
"icon": "dist",
"target": ["NSIS"],
"publish": ["github"]
All events are getting called with the exception of download-progress
Is there anything I´m doing wrong?
this._autoUpdater.checkForUpdates();
} else {
this._autoUpdater.checkForUpdatesAndNotify();
In dev mode the checkForUpdatesAndNotify does not trigger anything. That only works when it is packed. If you call checkForUpdates while in dev mode (electron-is-dev) then you should get the download events.
–
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.