A firefox extension to autorefresh the feed every X seconds
at main 914 B view raw
1let currentInterval = 15000; // Default interval (15 seconds) 2 3// Load the saved interval when the background script starts 4browser.storage.local.get('refreshInterval').then(result => { 5 currentInterval = result.refreshInterval || currentInterval; 6 notifyContentScript(currentInterval); 7}); 8 9// Listen for messages from the popup to update the interval 10browser.runtime.onMessage.addListener((request, sender, sendResponse) => { 11 if (request.action === 'updateInterval') { 12 currentInterval = request.interval; 13 browser.storage.local.set({ refreshInterval: currentInterval }); // Ensure it's saved 14 notifyContentScript(currentInterval); 15 } 16}); 17 18function notifyContentScript(interval) { 19 browser.tabs.query({ url: 'https://bsky.app/' }).then(tabs => { 20 tabs.forEach(tab => { 21 browser.tabs.sendMessage(tab.id, { action: 'setInterval', interval: interval }); 22 }); 23 }); 24}