only trigger notification on major v change

10.3.x-maintenance
cTn 2014-05-10 14:24:14 +02:00
parent 05f06075b2
commit 4fc1d3ef53
1 changed files with 22 additions and 16 deletions

View File

@ -37,6 +37,11 @@ chrome.app.runtime.onLaunched.addListener(function() {
chrome.runtime.onInstalled.addListener(function(details) {
if (details.reason == 'update') {
var previousVersionArr = details.previousVersion.split('.');
var currentVersionArr = chrome.runtime.getManifest().version.split('.');
// only fire up notification sequence when one of the major version numbers changed
if (currentVersionArr[0] != previousVersionArr[0] || currentVersionArr[1] != previousVersionArr[1]) {
chrome.storage.local.get('update_notify', function(result) {
if (typeof result.update_notify === 'undefined' || result.update_notify) {
var manifest = chrome.runtime.getManifest();
@ -55,6 +60,7 @@ chrome.runtime.onInstalled.addListener(function(details) {
}
});
}
}
});
chrome.notifications.onButtonClicked.addListener(function(notificationId, buttonIndex) {