mirror of
https://github.com/geekgeekrun/geekgeekrun.git
synced 2026-09-08 00:47:15 +08:00
move logic of mainWindow?.webContents.send 'common-job-condition-config-updated'
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
import { ipcMain } from 'electron'
|
import { ipcMain } from 'electron'
|
||||||
import { createCommonJobConditionConfigWindow } from '../window/commonJobConditionConfigWindow'
|
import { createCommonJobConditionConfigWindow } from '../window/commonJobConditionConfigWindow'
|
||||||
import { mainWindow } from '../window/mainWindow'
|
import { mainWindow } from '../window/mainWindow'
|
||||||
import { readConfigFile } from '@geekgeekrun/geek-auto-start-chat-with-boss/runtime-file-utils.mjs'
|
|
||||||
|
|
||||||
let commonJobConditionConfigWindow = null
|
let commonJobConditionConfigWindow = null
|
||||||
export async function waitForCommonJobConditionDone() {
|
export async function waitForCommonJobConditionDone() {
|
||||||
@@ -20,9 +19,6 @@ export async function waitForCommonJobConditionDone() {
|
|||||||
commonJobConditionConfigWindow.on('closed', async () => {
|
commonJobConditionConfigWindow.on('closed', async () => {
|
||||||
ipcMain.off('common-job-condition-config-done', handler)
|
ipcMain.off('common-job-condition-config-done', handler)
|
||||||
if (processDone) {
|
if (processDone) {
|
||||||
mainWindow?.webContents.send('common-job-condition-config-updated', {
|
|
||||||
config: await readConfigFile('common-job-condition-config.json')
|
|
||||||
})
|
|
||||||
resolve(true)
|
resolve(true)
|
||||||
} else {
|
} else {
|
||||||
reject(new Error('USER_CANCELLED'))
|
reject(new Error('USER_CANCELLED'))
|
||||||
|
|||||||
@@ -597,6 +597,9 @@ export default function initIpc() {
|
|||||||
})
|
})
|
||||||
ipcMain.handle('common-job-condition-config', async () => {
|
ipcMain.handle('common-job-condition-config', async () => {
|
||||||
await waitForCommonJobConditionDone()
|
await waitForCommonJobConditionDone()
|
||||||
|
mainWindow?.webContents.send('common-job-condition-config-updated', {
|
||||||
|
config: await readConfigFile('common-job-condition-config.json')
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
ipcMain.handle('exit-app-immediately', () => {
|
ipcMain.handle('exit-app-immediately', () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user