refactor: 1

pull/192/head
xiaojunnuo 2021-08-27 17:32:10 +08:00
parent 06c1fb0340
commit 542c5952a5
2 changed files with 10 additions and 6 deletions

View File

@ -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 () {

View File

@ -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