mirror of
https://github.com/Elvanos/fantasia-archive.git
synced 2024-09-30 17:20:44 +13: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()
|
||
|
}
|
||
|
}
|
||
|
}
|