mirror of
https://ark.sudovanilla.org/Korbs/electron-tabs.git
synced 2024-12-23 03:53:53 +00:00
Merge pull request #27 from ChenYuHo/master
fix issue #15 add duplicate tab when addTab with {active:true}
This commit is contained in:
commit
bb1262473d
7
index.js
7
index.js
|
@ -59,6 +59,10 @@ 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);
|
||||||
|
// 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);
|
this.emit("tab-added", tab, this);
|
||||||
return tab;
|
return tab;
|
||||||
}
|
}
|
||||||
|
@ -134,9 +138,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);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue