How can I update the title tag when there is an update? A few sites do this to indicate, and it’s handy to be able to see this when you have multiple tabs open.
I think .observeChanges() was what I was after!
Solved it with the below code:
var query = Links.find({foobar: {$exists: false}});
var handle = query.observeChanges({
added: function (id) {
addUpdateFlagToTitle = true;
}
});
setInterval(function () {
if (document.hidden && addUpdateFlagToTitle) {
document.title = '! ' + originalTitle;
}
if (!document.hidden) {
document.title = originalTitle;
addUpdateFlagToTitle = false;
}
}, 500);
1 Like