1
0
mirror of https://github.com/moparisthebest/mail synced 2024-11-22 17:02:17 -05:00

check for update everytime window open again... not just in background page

This commit is contained in:
Tankred Hase 2013-11-08 19:08:34 +01:00
parent 4ef1d1134c
commit a59229364e
3 changed files with 20 additions and 15 deletions

View File

@ -1,20 +1,5 @@
'use strict';
// check for update and restart app automatically
chrome.runtime.onUpdateAvailable.addListener(function(details) {
console.log("Updating to version " + details.version);
chrome.runtime.reload();
});
chrome.runtime.requestUpdateCheck(function(status) {
if (status === "update_found") {
console.log("Update pending...");
} else if (status === "no_update") {
console.log("No update found.");
} else if (status === "throttled") {
console.log("Checking updates too frequently.");
}
});
// open chrome app in new window
chrome.app.runtime.onLaunched.addListener(function() {
chrome.app.window.create('chrome.html', {

View File

@ -40,6 +40,23 @@ define(function(require) {
}
};
self.checkForUpdate = function() {
// check for update and restart app automatically
chrome.runtime.onUpdateAvailable.addListener(function(details) {
console.log("Updating to version " + details.version);
chrome.runtime.reload();
});
chrome.runtime.requestUpdateCheck(function(status) {
if (status === "update_found") {
console.log("Update pending...");
} else if (status === "no_update") {
console.log("No update found.");
} else if (status === "throttled") {
console.log("Checking updates too frequently.");
}
});
};
/**
* Request an OAuth token from chrome for gmail users
*/

View File

@ -16,6 +16,9 @@ define(function(require) {
return;
}
// check for app update
appController.checkForUpdate();
// login to imap
initializeUser();
});