mirror of
https://github.com/mifi/lossless-cut.git
synced 2024-11-22 10:22:31 +01:00
prompt before quit #229
This commit is contained in:
parent
f73f7691e1
commit
6906b69996
13
src/index.js
13
src/index.js
@ -31,6 +31,19 @@ function createWindow() {
|
||||
// when you should delete the corresponding element.
|
||||
mainWindow = null;
|
||||
});
|
||||
|
||||
// https://stackoverflow.com/questions/39574636/prompt-to-save-quit-before-closing-window/47434365
|
||||
mainWindow.on('close', (e) => {
|
||||
const choice = electron.dialog.showMessageBoxSync(mainWindow, {
|
||||
type: 'question',
|
||||
buttons: ['Yes', 'No'],
|
||||
title: 'Confirm quit',
|
||||
message: 'Are you sure you want to quit? You will lose all unsaved work',
|
||||
});
|
||||
if (choice === 1) {
|
||||
e.preventDefault();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// This method will be called when Electron has finished
|
||||
|
Loading…
Reference in New Issue
Block a user