File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
src/app/service/service_worker Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ import { getCurrentTab, InfoNotification } from "@App/pkg/utils/utils";
1818import { onTabRemoved , onUrlNavigated , setOnUserActionDomainChanged } from "./url_monitor" ;
1919import { LocalStorageDAO } from "@App/app/repo/localStorage" ;
2020import { onRegularUpdateCheckAlarm } from "./regular_updatecheck" ;
21+ import { cacheInstance } from "@App/app/cache" ;
2122
2223// service worker的管理器
2324export default class ServiceWorkerManager {
@@ -172,9 +173,14 @@ export default class ServiceWorkerManager {
172173 systemConfig . addListener ( "cloud_sync" , ( value ) => {
173174 synchronize . cloudSyncConfigChange ( value ) ;
174175 } ) ;
175- // 启动一次云同步
176- systemConfig . getCloudSync ( ) . then ( ( config ) => {
177- synchronize . cloudSyncConfigChange ( config ) ;
176+
177+ // 一些只需启动时运行一次的任务
178+ cacheInstance . getOrSet ( "extension_initialized" , ( ) => {
179+ // 启动一次云同步
180+ systemConfig . getCloudSync ( ) . then ( ( config ) => {
181+ synchronize . cloudSyncConfigChange ( config ) ;
182+ } ) ;
183+ return true ;
178184 } ) ;
179185
180186 if ( process . env . NODE_ENV === "production" ) {
You can’t perform that action at this time.
0 commit comments