pinafore/routes/_store/notificationObservers.js
2018-02-16 09:01:03 -08:00

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')
}
})
})
}