d4b0272fe7
* style(linter): enable consistent-type-imports rule in typescript * chore: add biome to lint script for improved code formatting * chore: add oxlint-specific lint script for faster linting * refactor: use type-only imports for better type safety and clarity
24 lines
682 B
TypeScript
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
|