fix issue #15 add duplicate tab when addTab with {active:true}

This commit is contained in:
Elton Chen-Yu Ho 2017-06-14 21:30:04 +08:00
parent 869fd7e45b
commit 7871f41e54

View file

@ -59,6 +59,9 @@ class TabGroup extends EventEmitter {
this.newTabId++; this.newTabId++;
let tab = new Tab(this, id, args); let tab = new Tab(this, id, args);
this.tabs.push(tab); this.tabs.push(tab);
if (args.active === true) {
tab.activate();
}
this.emit("tab-added", tab, this); this.emit("tab-added", tab, this);
return tab; return tab;
} }
@ -134,9 +137,6 @@ class Tab extends EventEmitter {
if (args.visible !== false) { if (args.visible !== false) {
this.show(); this.show();
} }
if (args.active === true) {
this.activate();
}
if (typeof args.ready === "function") { if (typeof args.ready === "function") {
args.ready(this); args.ready(this);
} }