Comments (6)
Maybe update-available event is fired before a renderer process is in ready state. It seems that most of update logic is concentrated on a renderer side, so I can recommend you to move initialize code from the main process to a renderer.
from electron-simple-updater.
I will move my initial code to the render side and try it again.
But shouldn't the events fire every time I call the method checkForUpdates()?
from electron-simple-updater.
Ok, I removed the code from the index.js and created a service on the render side.
If I check the logs I see this messages:
[2019-07-24 19:33:19.139] [info] UpdateApp checking updates...
**[2019-07-24 19:33:19.203] [debug] Update for win32-x64-prod-v1.0.190 is not available** (this log was not made by me, I think it came from your code)
[2019-07-24 19:33:35.093] [info] CloseApp Admin Action
[2019-07-24 19:33:35.142] [info]
[2019-07-24 19:33:35.142] [info] app 'will-quit'
[2019-07-24 19:33:35.142] [info]
[2019-07-24 19:33:35.143] [info] StartExplorerProcess
But for exemple the event "update-not-available" was not dispatch, a least me function did not run:
private onUpdateNotAvailable()
{
this.StatusUpdate = "There's no updates available.";
this.Log("onUpdateNotAvailable");
}
from electron-simple-updater.
Could you try the code to make sure the problem is not in another place?
this.UpdaterElectron = this.ElectronService.remote.require('electron-simple-updater');
this.UpdaterElectron.on('update-not-available', () => console.log('NOT AVAILABLE');
from electron-simple-updater.
Hello @megahertz .
Oddly it worked... I changed my functions as you suggested and it's working.
I also added all the events on the remote side (index.js).
Then I had to request a manual update, because the code was executed out of Angular context and the changes were not detected.
Admin page on the render side
public Init()
{
this.Log("this.UpdaterElectron.getFeedURL(): ", this.UpdaterElectron.getFeedURL());
this.UpdaterElectron.on('update-not-available', () =>
{
this.SetStatus("Não existem novas versões.", false);
this.Log("onUpdateNotAvailable message: ", this.StatusUpdate);
});
this.UpdaterElectron.on('update-available', (meta) =>
{
this.metaDataUpdate = meta;
this.SetStatus("Nova versão " + this.metaDataUpdate.version, false);
this.Log("onUpdateAvailable message: ", this.StatusUpdate);
});
}
public SetStatus(message:string, waitingResponse:boolean)
{
this.IsCheckingUpdates = waitingResponse;
this.StatusUpdate = message;
**this.ChangeDetectorRef.detectChanges();**
}
Thank you for your time and support.
from electron-simple-updater.
Instead, you can just bind you methods like
this.UpdaterElectron.on('update-available', this.onUpdateAvailable.bind(this));
(but in this case off methods will not work if you'll uncomment it)
or bind methods in constructor, or use such as thing as https://github.com/andreypopp/autobind-decorator
from electron-simple-updater.
Related Issues (20)
- NSIS Support HOT 3
- checkForUpdates not responding HOT 7
- Could not create temporary directory HOT 2
- Squirrel.Windows DEPRECATED :( HOT 6
- Enable downgrading/rollback HOT 1
- Update often fails on Raspberry Pi HOT 4
- Update is disabled because the app is not packaged HOT 4
- opt.logger.debug is not a function HOT 1
- What should be path of update for windows HOT 2
- Add User agent to request HOT 5
- Simple Updater: The Request was Aborted HOT 6
- Empty warning text HOT 2
- Support for download progress (important for slow connections) HOT 3
- Linux App image HOT 1
- cannot perform update "Update is disabled because the app is not packaged" HOT 3
- Where can i locate the downlaoded electron packages? HOT 2
- Stuck at downloading windows squirrel HOT 3
- Documentation for updates.json ? HOT 8
- File downloaded file gets truncated in linux if calling quitAndInstall. HOT 12
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from electron-simple-updater.