biome format --write

This commit is contained in:
Henry Jameson 2026-01-06 16:22:52 +02:00
commit 9262e803ec
415 changed files with 54076 additions and 17419 deletions

View file

@ -1,19 +1,27 @@
import {
showDesktopNotification as swDesktopNotification,
closeDesktopNotification as swCloseDesktopNotification,
isSWSupported
isSWSupported,
} from '../sw/sw.js'
const state = { failCreateNotif: false }
export const showDesktopNotification = (rootState, desktopNotificationOpts) => {
if (!('Notification' in window && window.Notification.permission === 'granted')) return
if (rootState.notifications.desktopNotificationSilence) { return }
if (
!('Notification' in window && window.Notification.permission === 'granted')
)
return
if (rootState.notifications.desktopNotificationSilence) {
return
}
if (isSWSupported()) {
swDesktopNotification(desktopNotificationOpts)
} else if (!state.failCreateNotif) {
try {
const desktopNotification = new window.Notification(desktopNotificationOpts.title, desktopNotificationOpts)
const desktopNotification = new window.Notification(
desktopNotificationOpts.title,
desktopNotificationOpts,
)
setTimeout(desktopNotification.close.bind(desktopNotification), 5000)
} catch {
state.failCreateNotif = true
@ -22,7 +30,10 @@ export const showDesktopNotification = (rootState, desktopNotificationOpts) => {
}
export const closeDesktopNotification = (rootState, { id }) => {
if (!('Notification' in window && window.Notification.permission === 'granted')) return
if (
!('Notification' in window && window.Notification.permission === 'granted')
)
return
if (isSWSupported()) {
swCloseDesktopNotification({ id })
@ -30,7 +41,10 @@ export const closeDesktopNotification = (rootState, { id }) => {
}
export const closeAllDesktopNotifications = () => {
if (!('Notification' in window && window.Notification.permission === 'granted')) return
if (
!('Notification' in window && window.Notification.permission === 'granted')
)
return
if (isSWSupported()) {
swCloseDesktopNotification({})