diff --git a/index.js b/index.js index 7728e3c..ff44f3a 100644 --- a/index.js +++ b/index.js @@ -59,6 +59,10 @@ class TabGroup extends EventEmitter { this.newTabId++; let tab = new Tab(this, id, args); this.tabs.push(tab); + // Don't call tab.activate() before a tab is referenced in this.tabs + if (args.active === true) { + tab.activate(); + } this.emit("tab-added", tab, this); return tab; } @@ -135,9 +139,6 @@ class Tab extends EventEmitter { if (args.visible !== false) { this.show(); } - if (args.active === true) { - this.activate(); - } if (typeof args.ready === "function") { args.ready(this); } diff --git a/package.json b/package.json index 9eeaa88..16f2f6c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "electron-tabs", - "version": "0.6.0", + "version": "0.6.1", "description": "Simple tabs for Electron applications", "main": "index.js", "repository": {