optimize: 捕获 `@natmri/platform-napi` 因缺失DLL而抛出异常,避免影响DS的启动
parent
ff311a854b
commit
ed220aa4b5
|
@ -14,7 +14,14 @@ const isMac = process.platform === 'darwin'
|
||||||
const isDevelopment = process.env.NODE_ENV !== 'production'
|
const isDevelopment = process.env.NODE_ENV !== 'production'
|
||||||
|
|
||||||
// 避免其他系统出现异常,只有 Windows 使用 './background/powerMonitor'
|
// 避免其他系统出现异常,只有 Windows 使用 './background/powerMonitor'
|
||||||
const _powerMonitor = isWindows ? require('./background/powerMonitor').powerMonitor : powerMonitor
|
let _powerMonitor = powerMonitor
|
||||||
|
if (isWindows) {
|
||||||
|
try {
|
||||||
|
_powerMonitor = require('./background/powerMonitor').powerMonitor
|
||||||
|
} catch (e) {
|
||||||
|
log.error(`加载 './background/powerMonitor' 失败,现使用默认的 powerMonitor:`, e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Keep a global reference of the window object, if you don't, the window will
|
// Keep a global reference of the window object, if you don't, the window will
|
||||||
// be closed automatically when the JavaScript object is garbage collected.
|
// be closed automatically when the JavaScript object is garbage collected.
|
||||||
|
|
Loading…
Reference in New Issue