cherry-studio/src/main/services/NotificationService.ts
fullex dc06c103e0
chore[lint]: add import type lint (#11091)
chore: add import type lint
2025-11-01 10:40:02 +08:00

24 lines
682 B
TypeScript

import type { Notification } from '@types'
import { Notification as ElectronNotification } from 'electron'
import { windowService } from './WindowService'
class NotificationService {
public async sendNotification(notification: Notification) {
// 使用 Electron Notification API
const electronNotification = new ElectronNotification({
title: notification.title,
body: notification.message
})
electronNotification.on('click', () => {
windowService.getMainWindow()?.show()
windowService.getMainWindow()?.webContents.send('notification-click', notification)
})
electronNotification.show()
}
}
export default NotificationService