mirror of
https://github.com/vector-im/element-web.git
synced 2024-11-18 06:35:35 +08:00
Display sync status in favicon and title
Signed-off-by: Aviral Dasgupta <me@aviraldg.com>
This commit is contained in:
parent
f66dd69710
commit
47c3419c0e
@ -599,7 +599,7 @@ module.exports = React.createClass({
|
|||||||
var cli = MatrixClientPeg.get();
|
var cli = MatrixClientPeg.get();
|
||||||
var self = this;
|
var self = this;
|
||||||
cli.on('sync', function(state, prevState) {
|
cli.on('sync', function(state, prevState) {
|
||||||
self.updateFavicon();
|
self.updateFavicon(state, prevState);
|
||||||
if (state === "SYNCING" && prevState === "SYNCING") {
|
if (state === "SYNCING" && prevState === "SYNCING") {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -887,7 +887,7 @@ module.exports = React.createClass({
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
updateFavicon: function() {
|
updateFavicon: function(state, prevState) {
|
||||||
var notifCount = 0;
|
var notifCount = 0;
|
||||||
|
|
||||||
var rooms = MatrixClientPeg.get().getRooms();
|
var rooms = MatrixClientPeg.get().getRooms();
|
||||||
@ -907,6 +907,11 @@ module.exports = React.createClass({
|
|||||||
console.warn("Failed to set badge count: "+e.message);
|
console.warn("Failed to set badge count: "+e.message);
|
||||||
}
|
}
|
||||||
document.title = "Vector"+(notifCount > 0 ? " ["+notifCount+"]" : "");
|
document.title = "Vector"+(notifCount > 0 ? " ["+notifCount+"]" : "");
|
||||||
|
|
||||||
|
if(state === "ERROR") {
|
||||||
|
this.favicon.badge("×");
|
||||||
|
document.title = "Vector [ERROR]";
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onUserSettingsClose: function() {
|
onUserSettingsClose: function() {
|
||||||
|
Loading…
Reference in New Issue
Block a user