Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
eight04 committed Nov 19, 2024
1 parent c745e77 commit d9e17af
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/lib/tab-monitor.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class TabMonitor extends EventLite {
}

_onUpdated(tabId, changeInfo, tab) {
if (!this._tabId) {
if (!this._tabId || tabId !== this._tabId) {
return;
}
if (!tab.url) {
Expand All @@ -42,17 +42,11 @@ class TabMonitor extends EventLite {
return;
}
}
if (tabId === this._tabId) {
this._tab = tab;
this.emit("change");
}
this._tab = tab;
this.emit("change");
}

getTab() {
// if (!this._tab) {
// const tabs = await browser.tabs.query({active: true, currentWindow: true});
// this._tab = tabs[0];
// }
return this._tab;
}

Expand Down

0 comments on commit d9e17af

Please sign in to comment.