分离方法
parent
9528b10d01
commit
442b4fb30f
|
@ -3,6 +3,7 @@ const { mainOn, mainSend } = require('@common/ipc')
|
|||
const USER_API_RENDERER_EVENT_NAME = require('../rendererEvent/name')
|
||||
const { createWindow } = require('../main')
|
||||
const { getUserApis } = require('../utils')
|
||||
const { openDevTools } = require('@main/utils')
|
||||
|
||||
let userApi
|
||||
let status = { status: true }
|
||||
|
@ -32,9 +33,7 @@ const handleResponse = (event, { status, data: { requestKey, result }, message }
|
|||
}
|
||||
const handleOpenDevTools = () => {
|
||||
if (global.modules.userApiWindow) {
|
||||
global.modules.userApiWindow.webContents.openDevTools({
|
||||
mode: 'undocked',
|
||||
})
|
||||
openDevTools(global.modules.userApiWindow.webContents)
|
||||
}
|
||||
}
|
||||
const handleShowUpdateAlert = (event, { data }) => {
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
const { mainOn, NAMES: { mainWindow: ipcMainWindowNames } } = require('../../common/ipc')
|
||||
const { openDevTools } = require('@main/utils')
|
||||
|
||||
mainOn(ipcMainWindowNames.open_dev_tools, event => {
|
||||
if (global.modules.mainWindow) {
|
||||
if (global.modules.mainWindow.isDevToolsOpened()) {
|
||||
global.modules.mainWindow.webContents.closeDevTools()
|
||||
} else {
|
||||
global.modules.mainWindow.webContents.openDevTools({
|
||||
mode: 'undocked',
|
||||
})
|
||||
openDevTools(global.modules.mainWindow.webContents)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
const { isWin } = require('../../common/utils')
|
||||
const { openDevTools } = require('@main/utils')
|
||||
const { mainSend, NAMES: { mainWindow: ipcMainWindowNames } } = require('../../common/ipc')
|
||||
global.isQuitting = false
|
||||
global.isTrafficLightClose = false // 是否点击软件上的关闭按钮关闭
|
||||
|
@ -30,7 +31,7 @@ module.exports = mainWindow => {
|
|||
mainWindow.once('ready-to-show', () => {
|
||||
mainWindow.show()
|
||||
global.lx_event.mainWindow.readyToShow()
|
||||
if (global.envParams.cmdParams.debug) global.modules.mainWindow.webContents.openDevTools()
|
||||
if (global.envParams.cmdParams.debug) openDevTools(global.modules.mainWindow.webContents)
|
||||
})
|
||||
|
||||
mainWindow.on('show', () => {
|
||||
|
|
|
@ -41,3 +41,9 @@ exports.initSetting = (isShowErrorAlert = true) => {
|
|||
global.appSetting = info.setting
|
||||
global.appSettingVersion = info.version
|
||||
}
|
||||
|
||||
exports.openDevTools = webContents => {
|
||||
webContents.openDevTools({
|
||||
mode: 'undocked',
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue