Add updating of window title on launch

The window title show the number of global unread messages when the
inbox window launches.
This commit is contained in:
ody 2015-11-10 22:25:52 +02:00 committed by lilia
parent 156c7c3b3d
commit 86edcc06c2

View file

@ -43,6 +43,10 @@
appWindow = windowInfo;
inboxWindowId = appWindow.id;
appWindow.contentWindow.addEventListener('load', function() {
setUnreadCount(storage.get("unreadCount", 0));
});
appWindow.onClosed.addListener(function () {
inboxOpened = false;
appWindow = null;
@ -75,13 +79,11 @@
if (count > 0) {
extension.navigator.setBadgeText(count);
if (inboxOpened === true) {
var appWindow = chrome.app.window.get(inboxWindowId);
appWindow.contentWindow.document.title = "Signal (" + count + ")";
}
} else {
extension.navigator.setBadgeText("");
if (inboxOpened === true) {
var appWindow = chrome.app.window.get(inboxWindowId);
appWindow.contentWindow.document.title = "Signal";
}
}