Skip to content

Commit

Permalink
update notification count
Browse files Browse the repository at this point in the history
  • Loading branch information
pradeepmdk committed Oct 12, 2023
1 parent 828b8b3 commit 88893c5
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@
*/
import CONFIG from '../../../CONFIG';

let _totalCount = 0;
/**
* Set the page title on web
*
* @param {Number} totalCount
*/
function updateUnread(totalCount) {
const hasUnread = totalCount !== 0;

_totalCount = totalCount;
// This setTimeout is required because due to how react rendering messes with the DOM, the document title can't be modified synchronously, and we must wait until all JS is done
// running before setting the title.
setTimeout(() => {
Expand All @@ -22,4 +23,8 @@ function updateUnread(totalCount) {
}, 0);
}

window.addEventListener('popstate', (event) => {
updateUnread(_totalCount)
})

export default updateUnread;

0 comments on commit 88893c5

Please sign in to comment.