Untitled
unknown
plain_text
9 months ago
657 B
8
Indexable
// Listen for the extension installation or update event
chrome.runtime.onInstalled.addListener(() => {
console.log('Extension installed or updated!');
});
// Listen for messages from content scripts or popups
chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
if (message.action === 'greet') {
console.log('Received greeting from:', sender.tab.url);
sendResponse({ reply: 'Hello from the background script!' });
}
});
// Listen for tab updates
chrome.tabs.onUpdated.addListener((tabId, changeInfo, tab) => {
if (changeInfo.status === 'complete') {
console.log('Tab updated:', tab.url);
}
});Editor is loading...
Leave a Comment