Created
March 13, 2024 19:55
-
-
Save DannyAziz/f017f23eb592f63caa893cff1ad280b9 to your computer and use it in GitHub Desktop.
Update content script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
chrome.runtime.onInstalled.addListener(async function (details) { | |
if (details.reason === "update") { | |
for (const cs of chrome.runtime.getManifest().content_scripts) { | |
for (const tab of await chrome.tabs.query({ url: cs.matches })) { | |
for (const file of cs.js) { | |
chrome.scripting.executeScript({ | |
target: { tabId: tab.id, allFrames: cs.all_frames ?? false }, | |
files: [file] | |
}) | |
} | |
} | |
} | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment