Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
feat: Auto Reload leetcode page on extension install
  • Loading branch information
Akash1000x committed Nov 28, 2024
commit b16afd8687ae04ec216ce6ffaebe3d94cf741b73
5 changes: 4 additions & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
"name": "LeetCode Whisper",
"version": "1.0.0",
"description": "Chrome extension providing AI-driven hints on LeetCode problems. Get step-by-step help to boost problem-solving skills effectively.",
"permissions": ["storage"],
"permissions": [
"storage",
"tabs"
],
"action": {
"default_popup": "index.html"
},
Expand Down
12 changes: 12 additions & 0 deletions src/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,15 @@ chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
chrome.action.openPopup() // Opens the popup programmatically
}
})

chrome.runtime.onInstalled.addListener((details) => {
if (details.reason === 'install' || details.reason === 'update') {
chrome.tabs.query({}, (tabs) => {
tabs.forEach((tab) => {
if (tab.url && /^https:\/\/leetcode\.com(\/.*)?$/.test(tab.url)) {
chrome.tabs.reload(tab.id, () => {})
}
})
})
}
})