Include exit code with quit event
This commit is contained in:
parent
aa82eddca8
commit
92433be888
10 changed files with 19 additions and 14 deletions
|
@ -180,8 +180,8 @@ void App::OnWindowAllClosed() {
|
|||
Emit("window-all-closed");
|
||||
}
|
||||
|
||||
void App::OnQuit() {
|
||||
Emit("quit");
|
||||
void App::OnQuit(const int code) {
|
||||
Emit("quit", code);
|
||||
|
||||
if (process_singleton_.get()) {
|
||||
process_singleton_->Cleanup();
|
||||
|
@ -344,7 +344,7 @@ mate::ObjectTemplateBuilder App::GetObjectTemplateBuilder(
|
|||
auto browser = base::Unretained(Browser::Get());
|
||||
return mate::ObjectTemplateBuilder(isolate)
|
||||
.SetMethod("quit", base::Bind(&Browser::Quit, browser))
|
||||
.SetMethod("_exit", base::Bind(&Browser::Exit, browser))
|
||||
.SetMethod("exit", base::Bind(&Browser::Exit, browser))
|
||||
.SetMethod("focus", base::Bind(&Browser::Focus, browser))
|
||||
.SetMethod("getVersion", base::Bind(&Browser::GetVersion, browser))
|
||||
.SetMethod("setVersion", base::Bind(&Browser::SetVersion, browser))
|
||||
|
|
|
@ -42,7 +42,7 @@ class App : public AtomBrowserClient::Delegate,
|
|||
void OnBeforeQuit(bool* prevent_default) override;
|
||||
void OnWillQuit(bool* prevent_default) override;
|
||||
void OnWindowAllClosed() override;
|
||||
void OnQuit() override;
|
||||
void OnQuit(int code) override;
|
||||
void OnOpenFile(bool* prevent_default, const std::string& file_path) override;
|
||||
void OnOpenURL(const std::string& url) override;
|
||||
void OnActivate(bool has_visible_windows) override;
|
||||
|
|
|
@ -34,17 +34,12 @@ app.setAppPath = (path) ->
|
|||
app.getAppPath = ->
|
||||
appPath
|
||||
|
||||
appExitCode = undefined
|
||||
app.exit = (exitCode) ->
|
||||
appExitCode = exitCode
|
||||
app._exit(exitCode)
|
||||
|
||||
# Map process.exit to app.exit, which quits gracefully.
|
||||
process.exit = app.exit
|
||||
|
||||
# Emit a process 'exit' event on app quit.
|
||||
app.on 'quit', ->
|
||||
process.emit 'exit', appExitCode
|
||||
app.on 'quit', (event, exitCode) ->
|
||||
process.emit 'exit', exitCode
|
||||
|
||||
# Routes the events to webContents.
|
||||
for name in ['login', 'certificate-error', 'select-client-certificate']
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue