Last active
January 26, 2023 11:23
-
-
Save bongkook/388d71337f72c0fe1192912b61e45003 to your computer and use it in GitHub Desktop.
This file contains 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.onUpdateAvailable.addListener(function(details) { | |
console.log("updating to version " + details.version); | |
chrome.runtime.reload(); | |
}); | |
chrome.runtime.requestUpdateCheck(function(status) { | |
if (status == "update_available") { | |
console.log("update pending..."); | |
} else if (status == "no_update") { | |
console.log("no update found"); | |
} else if (status == "throttled") { | |
console.log("Oops, I'm asking too frequently - I need to back off."); | |
} | |
}); | |
// background.js | |
chrome.runtime.onUpdateAvailable.addListener((details) => { | |
if (details) { | |
// if you 100% sure about this. | |
// chrome.runtime.reload(); | |
// too distract. | |
// alert(`New version (${details.version}) is available. Restart the browser to update.`); | |
// requires `notifications` permission. | |
// chrome.notifications.create({ | |
// type: "basic", | |
// iconUrl: chrome.extension.getURL("logo-48.png"), | |
// title: "Update available", | |
// message: `New version (${details.version}) is available. Restart the browser to update.` | |
// }); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment