bug修复
This commit is contained in:
+21
-1
@@ -351,9 +351,29 @@ ipcMain.on('myreader:allow-close', (event) => {
|
||||
win.close()
|
||||
})
|
||||
|
||||
let pendingOpenPaths: string[] = []
|
||||
|
||||
app.whenReady().then(() => {
|
||||
Menu.setApplicationMenu(buildMenu())
|
||||
createWindow()
|
||||
|
||||
const args = process.argv.slice(1)
|
||||
for (const arg of args) {
|
||||
if (existsSync(arg) && isMarkdownFile(arg)) {
|
||||
pendingOpenPaths.push(arg)
|
||||
}
|
||||
}
|
||||
|
||||
const win = createWindow()
|
||||
|
||||
win.webContents.on('dom-ready', () => {
|
||||
if (pendingOpenPaths.length > 0) {
|
||||
setTimeout(() => {
|
||||
win.webContents.send('myreader:open-files', pendingOpenPaths)
|
||||
pendingOpenPaths = []
|
||||
}, 500)
|
||||
}
|
||||
})
|
||||
|
||||
app.on('activate', () => {
|
||||
if (BrowserWindow.getAllWindows().length === 0) {
|
||||
createWindow()
|
||||
|
||||
Reference in New Issue
Block a user