diff --git a/packages/core/src/config.js b/packages/core/src/config.js index 85e0944b..743b32ca 100644 --- a/packages/core/src/config.js +++ b/packages/core/src/config.js @@ -82,7 +82,7 @@ function doMerge (defObj, newObj) { } let timer const configApi = { - startAutoDownloadRemoteConfig () { + async startAutoDownloadRemoteConfig () { if (timer != null) { clearInterval(timer) } @@ -90,7 +90,7 @@ const configApi = { await configApi.downloadRemoteConfig() configApi.reload() } - download() + await download() setInterval(download, 24 * 60 * 60 * 1000) // 1天 }, downloadRemoteConfig () { diff --git a/packages/gui/src/bridge/api/backend.js b/packages/gui/src/bridge/api/backend.js index b9b339cb..0c6612f0 100644 --- a/packages/gui/src/bridge/api/backend.js +++ b/packages/gui/src/bridge/api/backend.js @@ -124,6 +124,13 @@ function invoke (api, param) { return ret } +async function doStart () { + // 开启自动下载远程配置 + await DevSidecar.api.config.startAutoDownloadRemoteConfig() + // 启动所有 + localApi.startup() +} + export default { install ({ win }) { // 接收view的方法调用 @@ -150,10 +157,7 @@ export default { // 合并用户配置 DevSidecar.api.config.reload() - // 开启自动下载远程配置 - DevSidecar.api.config.startAutoDownloadRemoteConfig() - // 启动所有 - localApi.startup() + doStart() }, devSidecar: DevSidecar, invoke