Vin*_*eib 14 google-chrome-app
在Chrome Web商店中部署chrome打包应用程序并发布更新允许用户自动接收应用程序更新.在某些情况下,您想知道正在运行的应用程序是否是最新的,并更新它.例如:
对于文档chrome.runtime.requestUpdateCheck()提供的状态"throttled","no_update","update_available",但没有说明是否需要一个新的版本做什么.
小智 25
安装一个侦听器chrome.runtime.onUpdateAvailable,在下载新的.crx文件并准备好安装新版本时触发该侦听器.然后,致电chrome.runtime.requestUpdateCheck:
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.");
}
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4031 次 |
| 最近记录: |