mirror of
https://ark.sudovanilla.org/Korbs/electron-tabs.git
synced 2024-12-23 03:53:53 +00:00
Fix tabs activation
This commit is contained in:
parent
35bbcf88ea
commit
51777efe21
17
index.js
17
index.js
|
@ -57,12 +57,8 @@ class TabGroup {
|
||||||
let id = this.newTabId;
|
let id = this.newTabId;
|
||||||
this.newTabId++;
|
this.newTabId++;
|
||||||
let tab = new Tab(this, id, args);
|
let tab = new Tab(this, id, args);
|
||||||
this.pushTab(tab);
|
|
||||||
return tab;
|
|
||||||
}
|
|
||||||
|
|
||||||
pushTab (tab) {
|
|
||||||
this.tabs.push(tab);
|
this.tabs.push(tab);
|
||||||
|
return tab;
|
||||||
}
|
}
|
||||||
|
|
||||||
removeTab (tab) {
|
removeTab (tab) {
|
||||||
|
@ -77,18 +73,17 @@ class TabGroup {
|
||||||
|
|
||||||
setActiveTab (tab) {
|
setActiveTab (tab) {
|
||||||
this.removeTab(tab);
|
this.removeTab(tab);
|
||||||
this.pushTab(tab);
|
this.tabs.unshift(tab);
|
||||||
}
|
}
|
||||||
|
|
||||||
getActiveTab () {
|
getActiveTab () {
|
||||||
if (this.tabs.length < 1) return null;
|
if (this.tabs.length === 0) return null;
|
||||||
return this.tabs[this.tabs.length - 1];
|
return this.tabs[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
activateRecentTab (tab) {
|
activateRecentTab (tab) {
|
||||||
let recentTab = this.tabs[this.tabs.length - 1];
|
if (this.tabs.length === 0) return null;
|
||||||
if (!recentTab) return;
|
this.tabs[0].activate();
|
||||||
recentTab.activate();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue