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