зеркало из https://github.com/electron/electron.git
Add "quit" event for app.
This commit is contained in:
Родитель
dbbfef38b1
Коммит
909ff085ac
|
@ -91,6 +91,10 @@ void App::OnWindowAllClosed() {
|
|||
Emit("window-all-closed");
|
||||
}
|
||||
|
||||
void App::OnQuit() {
|
||||
Emit("quit");
|
||||
}
|
||||
|
||||
void App::OnOpenFile(bool* prevent_default, const std::string& file_path) {
|
||||
base::ListValue args;
|
||||
args.AppendString(file_path);
|
||||
|
|
|
@ -36,6 +36,7 @@ class App : public mate::EventEmitter,
|
|||
// BrowserObserver implementations:
|
||||
virtual void OnWillQuit(bool* prevent_default) OVERRIDE;
|
||||
virtual void OnWindowAllClosed() OVERRIDE;
|
||||
virtual void OnQuit() OVERRIDE;
|
||||
virtual void OnOpenFile(bool* prevent_default,
|
||||
const std::string& file_path) OVERRIDE;
|
||||
virtual void OnOpenURL(const std::string& url) OVERRIDE;
|
||||
|
|
|
@ -37,6 +37,8 @@ void Browser::Quit() {
|
|||
}
|
||||
|
||||
void Browser::Shutdown() {
|
||||
FOR_EACH_OBSERVER(BrowserObserver, observers_, OnQuit());
|
||||
|
||||
is_quiting_ = true;
|
||||
base::MessageLoop::current()->Quit();
|
||||
}
|
||||
|
|
|
@ -18,6 +18,9 @@ class BrowserObserver {
|
|||
// method will not be called, instead it will call OnWillQuit.
|
||||
virtual void OnWindowAllClosed() {}
|
||||
|
||||
// The browser is quitting.
|
||||
virtual void OnQuit() {}
|
||||
|
||||
// The browser has opened a file by double clicking in Finder or dragging the
|
||||
// file to the Dock icon. (OS X only)
|
||||
virtual void OnOpenFile(bool* prevent_default,
|
||||
|
|
|
@ -45,6 +45,10 @@ terminating the application.
|
|||
See description of `window-all-closed` for the differences between `will-quit`
|
||||
and it.
|
||||
|
||||
## Event: quit
|
||||
|
||||
Emitted when application is quitting.
|
||||
|
||||
## Event: open-file
|
||||
|
||||
* `event` Event
|
||||
|
|
Загрузка…
Ссылка в новой задаче