Merge pull request #81 from LiamBest/master

Add inactive event to the tab that's no longer marked active
This commit is contained in:
Thomas Brouard 2019-09-27 11:28:14 +02:00 committed by GitHub
commit 890469476b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 0 deletions

View file

@ -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) => { ... });`

View file

@ -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;