返回 AiToEarn
store.ts
1 /*
2 * @Author: nevin
3 * @Date: 2025-02-21 21:10:01
4 * @LastEditTime: 2025-02-21 21:12:28
5 * @LastEditors: nevin
6 * @Description: 存储
7 */
8 import { ipcMain } from 'electron';
9 import Store from 'electron-store';
10
11 export const store: any = new Store();
12 // 定义ipcRenderer监听事件
13 ipcMain.handle('setStore', (_, key, value) => {
14 store.set(key, value);
15 });
16 ipcMain.handle('getStore', async (_, key) => {
17 const value = store.get(key);
18 return value || '';
19 });
20
20 lines TYPESCRIPT