chore: migrated to typescript

This commit is contained in:
2025-10-08 11:09:16 +03:00
parent b5386c706f
commit 1ec17cd83e
12 changed files with 205 additions and 26 deletions

20
src/background.ts Normal file
View File

@@ -0,0 +1,20 @@
// Handle tab updates to inject content script
chrome.tabs.onUpdated.addListener((tabId: number, changeInfo: chrome.tabs.TabChangeInfo, tab: chrome.tabs.Tab): void => {
if (changeInfo.status === 'complete' && tab.url && /^https?:/.test(tab.url)) {
chrome.scripting.executeScript({
target: { tabId },
files: ['dist/main.js']
}).catch((err: unknown) => {
console.warn('Injection failed:', err);
});
}
});
// Initialize storage on extension install
chrome.runtime.onInstalled.addListener((): void => {
chrome.storage.local.get(['exceptionsList'], (result: any) => {
if (!result.exceptionsList) {
chrome.storage.local.set({ exceptionsList: [] });
}
});
});