From 7871f41e54ca413cb9e6830fc8fe678336b75040 Mon Sep 17 00:00:00 2001 From: Elton Chen-Yu Ho Date: Wed, 14 Jun 2017 21:30:04 +0800 Subject: [PATCH] fix issue #15 add duplicate tab when addTab with {active:true} --- index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 62882b9..e687848 100644 --- a/index.js +++ b/index.js @@ -59,6 +59,9 @@ class TabGroup extends EventEmitter { this.newTabId++; let tab = new Tab(this, id, args); this.tabs.push(tab); + if (args.active === true) { + tab.activate(); + } this.emit("tab-added", tab, this); return tab; } @@ -134,9 +137,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); }