update: Add notification number to app title

parent a96f829e
Pipeline #5214 passed with stage
in 1 minute and 27 seconds
......@@ -13,6 +13,8 @@ class SIBNotifications extends SIBTemplateElement {
this.favicon = new Favico({animation:'none'})
this.title = ""
// On read event, mark notification as read
window.addEventListener('read', event => {
if(event.detail && event.detail.resource && event.detail.resource['@id']) {
......@@ -116,7 +118,15 @@ class SIBNotifications extends SIBTemplateElement {
_updateUnread() {
let unread = this.querySelector('#badge-unread')
if(unread) this.favicon.badge(Number(unread.innerText))
if(unread) {
let unreadCount = Number(unread.innerText)
this.favicon.badge(unreadCount)
if(this.title=="") {
this.title = document.title;
}
if(unreadCount > 0) document.title = "(" + unreadCount + ") " + this.title
else document.title = this.title
}
}
_updateUI() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment