refactor all import in src/main to async import

This commit is contained in:
geekgeekrun
2024-03-24 11:17:03 +08:00
parent 778943a572
commit a72fcaf00f

View File

@@ -1,29 +1,37 @@
import { runAutoChat } from './flow/GEEK_AUTO_START_CHAT_WITH_BOSS_MAIN/index'
import { runAutoChatWithDaemon } from './flow/GEEK_AUTO_START_CHAT_WITH_BOSS_DAEMON/index'
import { openSettingWindow } from './flow/OPEN_SETTING_WINDOW'
import { checkAndDownloadDependenciesForInit } from './flow/CHECK_AND_DOWNLOAD_DEPENDENCIES/index'
import { launchBossZhipinLoginPageWithPreloadExtension } from './flow/LAUNCH_BOSS_ZHIPIN_LOGIN_PAGE_WITH_PRELOAD_EXTENSION'
const runMode = process.env.MAIN_BOSSGEEKGO_UI_RUN_MODE
switch (runMode) {
case 'geekAutoStartWithBossMain': {
runAutoChat()
break
;(async () => {
switch (runMode) {
case 'geekAutoStartWithBossMain': {
const { runAutoChat } = await import('./flow/GEEK_AUTO_START_CHAT_WITH_BOSS_MAIN/index')
runAutoChat()
break
}
case 'geekAutoStartWithBossDaemon': {
const { runAutoChatWithDaemon } = await import(
'./flow/GEEK_AUTO_START_CHAT_WITH_BOSS_DAEMON/index'
)
runAutoChatWithDaemon()
break
}
case 'checkAndDownloadDependenciesForInit': {
const { checkAndDownloadDependenciesForInit } = await import(
'./flow/CHECK_AND_DOWNLOAD_DEPENDENCIES/index'
)
checkAndDownloadDependenciesForInit()
break
}
case 'launchBossZhipinLoginPageWithPreloadExtension': {
const { launchBossZhipinLoginPageWithPreloadExtension } = await import(
'./flow/LAUNCH_BOSS_ZHIPIN_LOGIN_PAGE_WITH_PRELOAD_EXTENSION'
)
launchBossZhipinLoginPageWithPreloadExtension()
break
}
default: {
const { openSettingWindow } = await import('./flow/OPEN_SETTING_WINDOW')
openSettingWindow()
break
}
}
case 'geekAutoStartWithBossDaemon': {
runAutoChatWithDaemon()
break
}
case 'checkAndDownloadDependenciesForInit': {
checkAndDownloadDependenciesForInit()
break
}
case 'launchBossZhipinLoginPageWithPreloadExtension': {
launchBossZhipinLoginPageWithPreloadExtension()
break
}
default: {
openSettingWindow()
break
}
}
})()