@fe-free/core 2.8.7 → 2.8.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/package.json +2 -2
- package/src/core_app/index.tsx +12 -5
- package/src/style.scss +5 -0
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fe-free/core",
|
|
3
|
-
"version": "2.8.
|
|
3
|
+
"version": "2.8.9",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"author": "",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"safe-stable-stringify": "^2.5.0",
|
|
43
43
|
"vanilla-jsoneditor": "^0.23.1",
|
|
44
44
|
"zustand": "^4.5.4",
|
|
45
|
-
"@fe-free/tool": "2.8.
|
|
45
|
+
"@fe-free/tool": "2.8.9"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
48
|
"@ant-design/pro-components": "2.8.9",
|
package/src/core_app/index.tsx
CHANGED
|
@@ -17,13 +17,14 @@ function CheckUpdate({ basename }: { basename: string }) {
|
|
|
17
17
|
return;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
async function
|
|
20
|
+
async function getMainScriptPathname() {
|
|
21
21
|
const res = await fetch(`${basename}?r=${Date.now()}`);
|
|
22
22
|
const html = await res.text();
|
|
23
23
|
const parser = new DOMParser();
|
|
24
24
|
const doc = parser.parseFromString(html, 'text/html');
|
|
25
25
|
const nextMainScript = doc.querySelector('[data-name="mainScript"]');
|
|
26
|
-
|
|
26
|
+
const src = nextMainScript?.getAttribute('src');
|
|
27
|
+
return src ? new URL(src).pathname : null;
|
|
27
28
|
}
|
|
28
29
|
|
|
29
30
|
let ing = false;
|
|
@@ -49,13 +50,19 @@ function CheckUpdate({ basename }: { basename: string }) {
|
|
|
49
50
|
}
|
|
50
51
|
|
|
51
52
|
const src = mainScript.getAttribute('src');
|
|
53
|
+
const pathname = src ? new URL(src).pathname : null;
|
|
54
|
+
|
|
55
|
+
const checkUpdateInterval = parseInt(
|
|
56
|
+
localStorage.getItem('__free-checkUpdateInterval') || '60000',
|
|
57
|
+
10,
|
|
58
|
+
);
|
|
52
59
|
const timer = setInterval(async () => {
|
|
53
|
-
const
|
|
54
|
-
if (
|
|
60
|
+
const nextPathname = await getMainScriptPathname();
|
|
61
|
+
if (nextPathname !== pathname) {
|
|
55
62
|
confirm();
|
|
56
63
|
return;
|
|
57
64
|
}
|
|
58
|
-
},
|
|
65
|
+
}, checkUpdateInterval);
|
|
59
66
|
|
|
60
67
|
return () => {
|
|
61
68
|
clearInterval(timer);
|