Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
mainWindow.on('close', (event) => {
if (store.recordingChannels.length > 0) {
// 有录制中的视频, 将关闭过程转交给主窗口
event.preventDefault()
ipc.callRenderer(mainWindow, IPCMsg.OpenCloseTip)
} else {
// 主窗口关闭直接强制退出, 后面要兼容mac的话应该还要再修改
app.quit()
}
})
async click() {
// If called from splash window, send a message to show spinner
if (BrowserWindow.getFocusedWindow() === splashWindow) {
ipc.callRenderer(splashWindow, 'showSpinner');
}
const res = await openWindow();
if (res) {
closeSplashWindow();
}
},
},
click: () => {
if (store.recordingChannels.length > 0) {
if (!win.isVisible()) win.show()
win.focus()
ipc.callRenderer(mainWindow, IPCMsg.OpenCloseTip)
} else {
app.quit()
}
}
}
async onTick () {
try {
const servers = await getServerStats()
const tables = await getTableStats()
const indexes = await getIndexStats()
const resources = await getResourceStats()
const issues = await getIssuesStats()
const win = BrowserWindow.getAllWindows()
if (win.length) {
ipc.callRenderer(win[0], STATS_CHANNEL_NAME, {
servers,
tables,
indexes,
resources,
issues
})
}
} catch (e) {
console.warn('startLiveStats failed: ', e)
}
},
async startLiveStats () {
app.on('browser-window-blur', () => ipc.callRenderer(mainWindow, 'set-focused', false));
const callShortcut = shortcut => ipc.callRenderer(mainWindow, CALLS.SHORTCUT, shortcut);
app.on('browser-window-focus', () => ipc.callRenderer(mainWindow, 'set-focused', true));
.forEach(win => {
ipc.callRenderer(win, IPCMsg.SetConfig, config.data)
})
})
window.on("focus", async () => {
await callRenderer(window, "window-blur", "false");
});