Reputation: 275
I've got an electron app that manages data on quit. now, I've one option for that like if electron app quits manually by the user it should manage the state of ongoing data like that till now has app recorded should be stored in a local database and then the app should quit but If app quit unexpectedly then it should also check if data is not uploaded into live DB then first update it in local and then sync it with live.
highlights of question:
If anyone has any idea to do that in simple steps without and breakage it would be very helpful for me. thanks in advance.
Upvotes: 0
Views: 481
Reputation: 4721
it should sync the data to live if the user manually quits the app.
Yes. You can easily do lot of things thanks to app event like that :
app.on('window-all-closed', () => {
// put what you want here
app.quit()
})
You also have this event, perhaps help you:
process.on("uncaughtException", (err) => {
const messageBoxOptions = {
type: "error",
title: "Error in Main process",
message: "Something failed"
};
dialog.showMessageBox(messageBoxOptions);
throw err;
});
Upvotes: 0