frpc-desktop/electron/api/common.ts

17 lines
379 B
TypeScript
Raw Normal View History

2024-08-22 14:19:19 +08:00
import { app, ipcMain, shell } from "electron";
2024-08-11 16:54:01 +08:00
import log from "electron-log";
export const initCommonApi = () => {
2024-08-22 14:19:19 +08:00
// 打开链接
ipcMain.on("common.openUrl", async (event, args) => {
if (args) {
log.info(`打开链接:${args}`);
shell.openExternal(args).then(() => {});
}
});
2024-08-11 16:54:01 +08:00
2024-08-22 14:19:19 +08:00
ipcMain.on("common.relaunch", () => {
app.relaunch();
});
};