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
2 changed files with 4 additions and 0 deletions
|
@ -207,6 +207,7 @@ The following events are available:
|
|||
* `tab.on("title-changed", (title, tab) => { ... });`
|
||||
* `tab.on("icon-changed", (icon, tab) => { ... });`
|
||||
* `tab.on("active", (tab) => { ... });`
|
||||
* `tab.on("inactive", (tab) => { ... });`
|
||||
* `tab.on("visible", (tab) => { ... });`
|
||||
* `tab.on("hidden", (tab) => { ... });`
|
||||
* `tab.on("flash", (tab) => { ... });`
|
||||
|
|
3
index.js
3
index.js
|
@ -181,6 +181,7 @@ class Tab extends EventEmitter {
|
|||
if (this.isClosed) return;
|
||||
let span = this.tabElements.title;
|
||||
span.innerHTML = title;
|
||||
span.title = title;
|
||||
this.title = title;
|
||||
this.emit("title-changed", title, this);
|
||||
return this;
|
||||
|
@ -284,6 +285,7 @@ class Tab extends EventEmitter {
|
|||
if (activeTab) {
|
||||
activeTab.tab.classList.remove("active");
|
||||
activeTab.webview.classList.remove("visible");
|
||||
activeTab.emit("inactive", activeTab);
|
||||
}
|
||||
TabGroupPrivate.setActiveTab.bind(this.tabGroup)(this);
|
||||
this.tab.classList.add("active");
|
||||
|
@ -417,3 +419,4 @@ const TabPrivate = {
|
|||
};
|
||||
|
||||
module.exports = TabGroup;
|
||||
|
||||
|
|
Loading…
Reference in a new issue