فهرست منبع

[edit][升级reload]

zhangwei 2 سال پیش
والد
کامیت
2aeff4e802
1فایلهای تغییر یافته به همراه17 افزوده شده و 11 حذف شده
  1. 17 11
      src/entry/background.js

+ 17 - 11
src/entry/background.js

@@ -89,18 +89,9 @@ chrome.tabs.onActivated.addListener(function (activeInfo) {
     setPopupConfig(activeInfo);
 })
 
-function onInstalledMethod() {
+function thenInstalledMethod() {
     try {
-        // 版本更新判断
-        getChromeStorage('baseInfo', (info) => {
-            if (!info || !info.appVersionCode) {
-                setChromeStorage({ baseInfo: JSON.stringify({ appVersionCode }) })
-            } else if (appVersionCode != info.appVersionCode) {
-                setChromeStorage({ baseInfo: JSON.stringify({ appVersionCode }) }, () => {
-                    chrome.runtime.reload()
-                })
-            }
-        })
+
         onInstalledCreateTab()
         onInstalledMid()
         onInstalledUserSet()
@@ -132,6 +123,21 @@ function onInstalledMethod() {
         });
     }
 }
+function onInstalledMethod() {
+    // 版本更新判断
+    getChromeStorage('baseInfo', (info) => {
+        if (!info || !info.appVersionCode) {
+            setChromeStorage({ baseInfo: JSON.stringify({ appVersionCode }) })
+            thenInstalledMethod()
+        } else if (appVersionCode != info.appVersionCode) {
+            setChromeStorage({ baseInfo: JSON.stringify({ appVersionCode }) }, () => {
+                chrome.runtime.reload()
+            })
+        } else {
+            thenInstalledMethod()
+        }
+    })
+}
 
 function onMessageMethod(req, sender, sendResponse) {
     try {