-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
54 lines (54 loc) · 1.21 KB
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
try {
let allLibNotNeedUpdate = true;
const libCheckResult = libVersionCheck();
Object.keys(libCheckResult).map(libId => {
if (libCheckResult[libId] == false) {
allLibNotNeedUpdate = false;
}
});
if (allLibNotNeedUpdate == true) {
require("./scripts/app").run();
} else {
$ui.alert({
title: "外部库需要更新",
message: JSON.stringify(libCheckResult),
actions: [
{
title: "Exit",
disabled: false, // Optional
handler: () => {
$app.close();
}
}
]
});
}
} catch (error) {
$console.error(error);
$ui.alert({
title: "app.run error",
message: { name: error.name, message: error.message },
actions: [
{
title: "EXIT",
disabled: false, // Optional
handler: () => {
$app.close();
}
}
]
});
}
function libVersionCheck() {
const libList = { CoreJS: 13, $: 1, Next: 2 },
checkResult = {};
Object.keys(libList).map(libId => {
const lib = require(libId);
if (lib == undefined) {
checkResult[libId] = false;
} else {
checkResult[libId] = lib.VERSION == libList[libId];
}
});
return checkResult;
}