signal-desktop/js/background.js

17 lines
592 B
JavaScript
Raw Normal View History

2014-01-22 06:23:41 +00:00
registerOnLoadFunction(function() {
if (!localStorage.getItem('first_install_ran')) {
localStorage.setItem('first_install_ran', 1);
chrome.tabs.create({url: "options.html"});
} else {
if (isRegistrationDone()) {
subscribeToPush(function(message) {
console.log("Got message from " + message.source + ": \"" + getString(message.message));
var newUnreadCount = storage.getUnencrypted("unreadCount") + 1;
storage.putUnencrypted("unreadCount", newUnreadCount);
chrome.browserAction.setBadgeText({text: newUnreadCount + ""});
storeMessage(message);
});
}
2014-01-12 14:07:13 +00:00
}
2014-01-22 06:23:41 +00:00
});