From bbf88353978e1b53b3f5f626dcaee8590949568f Mon Sep 17 00:00:00 2001 From: Thomas Brouard Date: Wed, 2 Nov 2016 16:37:23 +0100 Subject: [PATCH] Add "active" option --- README.md | 1 + index.js | 3 +++ 2 files changed, 4 insertions(+) diff --git a/README.md b/README.md index 5980393..badcce6 100644 --- a/README.md +++ b/README.md @@ -67,6 +67,7 @@ Add a new tab to the tab group and returns a `Tab` instance. * `closable` (default: `true`): if set to `true` the close button won't be displayed and the user won't be able to close the tab. See also `tab.close()`. * `webviewAttributes`: attributes to add to the webview tag. See [webview documentation](http://electron.atom.io/docs/api/web-view-tag/#tag-attributes). * `visible` (default: `true`): set this to `false` if you don't want to display the tab once it is loaded. If set to `false` then you will need to call `tab.show()` to display the tab. +* `active` (default: `false`): set this to `true` if you want to activate the tab once it is loaded. Otherwise you will need to call `tab.activate()`. * `ready`: a callback function to call once the tab is ready. The `Tab` instance is passed as the only parameter. #### `tabGroup.getTab(id)` diff --git a/index.js b/index.js index 903a05c..7778402 100644 --- a/index.js +++ b/index.js @@ -133,6 +133,9 @@ class Tab extends EventEmitter { if (args.visible !== false) { this.show(); } + if (args.active === true) { + this.activate(); + } if (typeof args.ready === "function") { args.ready(this); }