mirror of
https://github.com/Elvanos/fantasia-archive.git
synced 2024-05-23 13:40:16 +12:00
43 lines
1.1 KiB
TypeScript
43 lines
1.1 KiB
TypeScript
import { BrowserWindow } from '@electron/remote'
|
|
import { I_faDevToolsControl } from 'app/interfaces/I_faDevToolsControl'
|
|
|
|
export const faDevToolsControlAPI: I_faDevToolsControl = {
|
|
|
|
checkDecToolsStatus () {
|
|
const currentWindow = BrowserWindow.getFocusedWindow()
|
|
if (currentWindow !== null) {
|
|
return currentWindow.webContents.isDevToolsOpened()
|
|
}
|
|
return false
|
|
},
|
|
|
|
toggleDevTools () {
|
|
const currentWindow = BrowserWindow.getFocusedWindow()
|
|
|
|
if (currentWindow !== null) {
|
|
const devToolsOpened = currentWindow.webContents.isDevToolsOpened()
|
|
if (devToolsOpened) {
|
|
currentWindow.webContents.closeDevTools()
|
|
} else {
|
|
currentWindow.webContents.openDevTools()
|
|
}
|
|
}
|
|
},
|
|
|
|
openDevTools () {
|
|
const currentWindow = BrowserWindow.getFocusedWindow()
|
|
|
|
if (currentWindow !== null) {
|
|
currentWindow.webContents.openDevTools()
|
|
}
|
|
},
|
|
|
|
closeDevTools () {
|
|
const currentWindow = BrowserWindow.getFocusedWindow()
|
|
|
|
if (currentWindow !== null) {
|
|
currentWindow.webContents.closeDevTools()
|
|
}
|
|
}
|
|
}
|