mirror of
https://ark.sudovanilla.org/Korbs/electron-tabs.git
synced 2025-01-08 20:03:57 +00:00
Merge pull request #81 from LiamBest/master
Add inactive event to the tab that's no longer marked active
This commit is contained in:
commit
890469476b
|
@ -207,6 +207,7 @@ The following events are available:
|
||||||
* `tab.on("title-changed", (title, tab) => { ... });`
|
* `tab.on("title-changed", (title, tab) => { ... });`
|
||||||
* `tab.on("icon-changed", (icon, tab) => { ... });`
|
* `tab.on("icon-changed", (icon, tab) => { ... });`
|
||||||
* `tab.on("active", (tab) => { ... });`
|
* `tab.on("active", (tab) => { ... });`
|
||||||
|
* `tab.on("inactive", (tab) => { ... });`
|
||||||
* `tab.on("visible", (tab) => { ... });`
|
* `tab.on("visible", (tab) => { ... });`
|
||||||
* `tab.on("hidden", (tab) => { ... });`
|
* `tab.on("hidden", (tab) => { ... });`
|
||||||
* `tab.on("flash", (tab) => { ... });`
|
* `tab.on("flash", (tab) => { ... });`
|
||||||
|
|
3
index.js
3
index.js
|
@ -181,6 +181,7 @@ class Tab extends EventEmitter {
|
||||||
if (this.isClosed) return;
|
if (this.isClosed) return;
|
||||||
let span = this.tabElements.title;
|
let span = this.tabElements.title;
|
||||||
span.innerHTML = title;
|
span.innerHTML = title;
|
||||||
|
span.title = title;
|
||||||
this.title = title;
|
this.title = title;
|
||||||
this.emit("title-changed", title, this);
|
this.emit("title-changed", title, this);
|
||||||
return this;
|
return this;
|
||||||
|
@ -284,6 +285,7 @@ class Tab extends EventEmitter {
|
||||||
if (activeTab) {
|
if (activeTab) {
|
||||||
activeTab.tab.classList.remove("active");
|
activeTab.tab.classList.remove("active");
|
||||||
activeTab.webview.classList.remove("visible");
|
activeTab.webview.classList.remove("visible");
|
||||||
|
activeTab.emit("inactive", activeTab);
|
||||||
}
|
}
|
||||||
TabGroupPrivate.setActiveTab.bind(this.tabGroup)(this);
|
TabGroupPrivate.setActiveTab.bind(this.tabGroup)(this);
|
||||||
this.tab.classList.add("active");
|
this.tab.classList.add("active");
|
||||||
|
@ -417,3 +419,4 @@ const TabPrivate = {
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = TabGroup;
|
module.exports = TabGroup;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue