Skip to content

Commit

Permalink
optimize: 捕获 @natmri/platform-napi 因缺失DLL而抛出异常,避免影响DS的启动
Browse files Browse the repository at this point in the history
  • Loading branch information
wangliang181230 committed Nov 29, 2024
1 parent ff311a8 commit ed220aa
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/gui/src/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,14 @@ const isMac = process.platform === 'darwin'
const isDevelopment = process.env.NODE_ENV !== 'production'

// 避免其他系统出现异常,只有 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
// be closed automatically when the JavaScript object is garbage collected.
Expand Down

0 comments on commit ed220aa

Please sign in to comment.