18 lines
438 B
JavaScript
18 lines
438 B
JavaScript
import { setFavicon } from '../_utils/setFavicon'
|
|
import { scheduleIdleTask } from '../_utils/scheduleIdleTask'
|
|
|
|
export function notificationObservers (store) {
|
|
store.observe('hasNotifications', hasNotifications => {
|
|
if (!process.browser) {
|
|
return
|
|
}
|
|
scheduleIdleTask(() => {
|
|
if (hasNotifications) {
|
|
setFavicon('/favicon-alert.png')
|
|
} else {
|
|
setFavicon('/favicon.png')
|
|
}
|
|
})
|
|
})
|
|
}
|