mirror of
https://github.com/skidoodle/hostinfo
synced 2026-04-28 09:37:37 +02:00
call stuff
This commit is contained in:
@@ -164,6 +164,32 @@ async function updateState(tabId: number, updates: Partial<TabState>, expectedUr
|
|||||||
|
|
||||||
export default defineBackground({
|
export default defineBackground({
|
||||||
main() {
|
main() {
|
||||||
|
browser.runtime.onStartup.addListener(() => {
|
||||||
|
StorageService.cleanExpiredGeoCache().catch(console.error);
|
||||||
|
});
|
||||||
|
|
||||||
|
browser.runtime.onInstalled.addListener(() => {
|
||||||
|
StorageService.cleanExpiredGeoCache().catch(console.error);
|
||||||
|
});
|
||||||
|
|
||||||
|
browser.alarms.create('cleanup-geo-cache', { periodInMinutes: 1440 });
|
||||||
|
browser.alarms.onAlarm.addListener((alarm) => {
|
||||||
|
if (alarm.name === 'cleanup-geo-cache') {
|
||||||
|
StorageService.cleanExpiredGeoCache().catch(console.error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
browser.tabs.onReplaced.addListener((addedTabId, removedTabId) => {
|
||||||
|
tabStates.delete(removedTabId);
|
||||||
|
StorageService.removeTabState(removedTabId);
|
||||||
|
|
||||||
|
browser.tabs.get(addedTabId).then((tab) => {
|
||||||
|
if (tab.url) {
|
||||||
|
initTab(tab.id!, tab.url, true)
|
||||||
|
}
|
||||||
|
}).catch(() => { })
|
||||||
|
})
|
||||||
|
|
||||||
browser.webNavigation.onBeforeNavigate.addListener((details) => {
|
browser.webNavigation.onBeforeNavigate.addListener((details) => {
|
||||||
if (details.frameId !== 0) return;
|
if (details.frameId !== 0) return;
|
||||||
initTab(details.tabId, details.url, false);
|
initTab(details.tabId, details.url, false);
|
||||||
|
|||||||
Reference in New Issue
Block a user