返回 AiToEarn
notice.ts
1 /*
2 * @Author: nevin
3 * @Date: 2025-03-24 23:18:06
4 * @LastEditTime: 2025-03-24 23:19:06
5 * @LastEditors: nevin
6 * @Description: 系统通知
7 */
8 import { Notification } from 'electron';
9 export const sysNotice = (title: string, body: string) =>
10 new Promise((resolve, reject) => {
11 if (!Notification.isSupported()) reject('当前系统不支持通知');
12
13 const options = typeof title === 'object' ? title : { title, body };
14 const notification = new Notification(options);
15 notification.on('click', resolve);
16 notification.show();
17 });
18
18 lines TYPESCRIPT