Skip to content

Commit

Permalink
Merge pull request #2 from ezequielmross/main
Browse files Browse the repository at this point in the history
Fix firefox
  • Loading branch information
Hazyzh authored Sep 12, 2024
2 parents d1cc6ff + 1593b49 commit eaeb5e1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tabs-manager",
"version": "1.0.3",
"version": "1.0.4",
"description": "Definition one active tab on multiple tabs scenarios. ",
"main": "./lib/index.js",
"scripts": {
Expand Down
6 changes: 5 additions & 1 deletion src/caller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,11 @@ export class TabsManagerWorkerCaller extends EventEmitter {
if (!this.workerInstance) return;

window.addEventListener('focus', this.setActiveTab);
document.addEventListener('visibilitychange', this.setActiveTab);
document.addEventListener('visibilitychange', () => {
if (document.visibilityState !== 'hidden') {
this.setActiveTab();
}
});
window.addEventListener('unload', this.closeWindow);

if (document.visibilityState === 'visible') {
Expand Down

0 comments on commit eaeb5e1

Please sign in to comment.