better startup logs

This commit is contained in:
Ilya Ig. Petrov 2016-01-26 21:05:23 +05:00
parent 278aaad865
commit a4b83d100c

View File

@ -68,7 +68,7 @@ window.antiCensorRu = {
for(var key of Object.keys(storage)) for(var key of Object.keys(storage))
this[key] = storage[key]; this[key] = storage[key];
console.log('Pulled from storage, any callback?', !!cb); console.log('Synced with storage, any callback?', !!cb);
if (cb) if (cb)
cb(chrome.runtime.lastError, storage); cb(chrome.runtime.lastError, storage);
}); });
@ -146,17 +146,25 @@ window.storageSyncedPromise.then(
} }
} }
); );
console.log('Installed alarm listener.'); console.log('Alarm listener installed. We won\'t miss any PAC update.');
chrome.alarms.get(
window.antiCensorRu._periodicUpdateAlarmReason,
alarm => alarm && console.log(
'Next update is scheduled on', new Date(alarm.scheduledTime).toLocaleString('ru-RU')
)
);
} }
); );
chrome.runtime.onInstalled.addListener( details => { chrome.runtime.onInstalled.addListener( details => {
console.log('Installing, reason:', details.reason); console.log('Extension just installed, reason:', details.reason);
window.storageSyncedPromise.then( window.storageSyncedPromise.then(
storage => { storage => {
switch(details.reason) { switch(details.reason) {
case 'update': case 'update':
window.antiCensorRu.installPac(); console.log('Ah, it\'s just an update or reload. Do nothing.');
//window.antiCensorRu.installPac();
break; break;
case 'install': case 'install':
window.antiCensorRu.ifNotInstalled = true; window.antiCensorRu.ifNotInstalled = true;