:apple: Add Show to API for OS X
authorSimon Madine <simon.madine@here.com>
Sat, 30 Jan 2016 20:40:32 +0000 (21:40 +0100)
committerSimon Madine <simon.madine@here.com>
Sat, 30 Jan 2016 21:30:38 +0000 (22:30 +0100)
atom/browser/api/atom_api_app.cc
atom/browser/browser.h
atom/browser/browser_mac.mm
docs/api/app.md

index 0562cf8..e54d7fe 100644 (file)
@@ -369,6 +369,7 @@ mate::ObjectTemplateBuilder App::GetObjectTemplateBuilder(
                  base::Bind(&Browser::SetAppUserModelID, browser))
 #if defined(OS_MACOSX)
       .SetMethod("hide", base::Bind(&Browser::Hide, browser))
+      .SetMethod("show", base::Bind(&Browser::Show, browser))
 #endif
 #if defined(OS_WIN)
       .SetMethod("setUserTasks",
index dc811fc..2c44eaa 100644 (file)
@@ -80,6 +80,9 @@ class Browser : public WindowListObserver {
   // Hide the application.
   void Hide();
 
+  // Show the application.
+  void Show();
+
   // Bounce the dock icon.
   enum BounceType {
     BOUNCE_CRITICAL = 0,
index db89801..bf9c9ef 100644 (file)
@@ -22,6 +22,10 @@ void Browser::Hide() {
   [[AtomApplication sharedApplication] hide:nil];
 }
 
+void Browser::Show() {
+  [[AtomApplication sharedApplication] unhide:nil];
+}
+
 void Browser::AddRecentDocument(const base::FilePath& path) {
   NSString* path_string = base::mac::FilePathToNSString(path);
   if (!path_string)
index 808f5fa..4b5c6ee 100644 (file)
@@ -248,6 +248,10 @@ returning `false` in the `beforeunload` event handler.
 
 Hides all application windows without minimising them.
 
+### `app.show()` _OS X_
+
+Shows application windows after they were hidden. Does not automatically focus them.
+
 ### `app.exit(exitCode)`
 
 * `exitCode` Integer