mirror of
https://github.com/obsqrbtz/goose-highlighter.git
synced 2026-04-09 20:47:53 +03:00
chore: migrated to typescript
This commit is contained in:
20
src/background.ts
Normal file
20
src/background.ts
Normal 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: [] });
|
||||
}
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user