🍎 Add 'Hide' to App API for OS X only
This commit is contained in:
parent
30b35644f6
commit
7a370ccd0f
4 changed files with 12 additions and 0 deletions
|
@ -356,6 +356,7 @@ mate::ObjectTemplateBuilder App::GetObjectTemplateBuilder(
|
||||||
.SetMethod("quit", base::Bind(&Browser::Quit, browser))
|
.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("focus", base::Bind(&Browser::Focus, browser))
|
||||||
|
.SetMethod("hide", base::Bind(&Browser::Hide, browser))
|
||||||
.SetMethod("getVersion", base::Bind(&Browser::GetVersion, browser))
|
.SetMethod("getVersion", base::Bind(&Browser::GetVersion, browser))
|
||||||
.SetMethod("setVersion", base::Bind(&Browser::SetVersion, browser))
|
.SetMethod("setVersion", base::Bind(&Browser::SetVersion, browser))
|
||||||
.SetMethod("getName", base::Bind(&Browser::GetName, browser))
|
.SetMethod("getName", base::Bind(&Browser::GetName, browser))
|
||||||
|
|
|
@ -55,6 +55,9 @@ class Browser : public WindowListObserver {
|
||||||
// Focus the application.
|
// Focus the application.
|
||||||
void Focus();
|
void Focus();
|
||||||
|
|
||||||
|
// Focus the application.
|
||||||
|
void Hide();
|
||||||
|
|
||||||
// Returns the version of the executable (or bundle).
|
// Returns the version of the executable (or bundle).
|
||||||
std::string GetVersion() const;
|
std::string GetVersion() const;
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,10 @@ void Browser::Focus() {
|
||||||
[[AtomApplication sharedApplication] activateIgnoringOtherApps:YES];
|
[[AtomApplication sharedApplication] activateIgnoringOtherApps:YES];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Browser::Hide() {
|
||||||
|
[[AtomApplication sharedApplication] hide:nil];
|
||||||
|
}
|
||||||
|
|
||||||
void Browser::AddRecentDocument(const base::FilePath& path) {
|
void Browser::AddRecentDocument(const base::FilePath& path) {
|
||||||
NSString* path_string = base::mac::FilePathToNSString(path);
|
NSString* path_string = base::mac::FilePathToNSString(path);
|
||||||
if (!path_string)
|
if (!path_string)
|
||||||
|
|
|
@ -244,6 +244,10 @@ This method guarantees that all `beforeunload` and `unload` event handlers are
|
||||||
correctly executed. It is possible that a window cancels the quitting by
|
correctly executed. It is possible that a window cancels the quitting by
|
||||||
returning `false` in the `beforeunload` event handler.
|
returning `false` in the `beforeunload` event handler.
|
||||||
|
|
||||||
|
### `app.hide()` _OS X_
|
||||||
|
|
||||||
|
Hides all application windows without minimising them.
|
||||||
|
|
||||||
### `app.exit(exitCode)`
|
### `app.exit(exitCode)`
|
||||||
|
|
||||||
* `exitCode` Integer
|
* `exitCode` Integer
|
||||||
|
|
Loading…
Reference in a new issue