Skip to content

Commit

Permalink
♻️ Add small refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
ssakone committed Dec 25, 2023
1 parent b0f318e commit 19cdbb4
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/lib/services/background.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,10 @@ import { profileController } from '$lib/controllers/profile.controller';
import { sessionController } from '$lib/controllers/session.controller';
import { backgroundController } from '$lib/controllers/background.controller';

const session = sessionController();
const background = backgroundController();
const session = sessionController();

web.runtime.onInstalled.addListener(() => BrowserUtil.injectJsinAllTabs('content.js'));
web.runtime.onStartup.addListener(() => BrowserUtil.injectJsinAllTabs('content.js'));

web.tabs.onActivated.addListener(async (activeInfo) => {
console.log('onActivated', activeInfo);
const switchIcon = async (activeInfo: chrome.tabs.TabActiveInfo) => {
const tab = await web.tabs.get(activeInfo.tabId);

const user: Profile = await background.getUserProfile();
Expand All @@ -34,7 +30,12 @@ web.tabs.onActivated.addListener(async (activeInfo) => {
path: 'assets/logo-off.png'
});
}
})
}


web.runtime.onInstalled.addListener(() => BrowserUtil.injectJsinAllTabs('content.js'));
web.runtime.onStartup.addListener(() => BrowserUtil.injectJsinAllTabs('content.js'));
web.tabs.onActivated.addListener(async (activeInfo) => switchIcon(activeInfo));

const responders: Responders = {};
const requestQueue: any[] = [];
Expand Down

0 comments on commit 19cdbb4

Please sign in to comment.