[Refactor] Remove old workarounds (#2242)

This commit is contained in:
filtered
2025-01-15 02:52:34 +11:00
committed by GitHub
parent 04153caaf5
commit 00f031e382
3 changed files with 14 additions and 14 deletions

View File

@@ -1,17 +1,16 @@
import { ElectronAPI } from '@comfyorg/comfyui-electron-types'
export type InstallOptions = Parameters<ElectronAPI['installComfyUI']>[0]
export type TorchDeviceType = InstallOptions['device']
import {
ElectronAPI,
ElectronContextMenuOptions
} from '@comfyorg/comfyui-electron-types'
export function isElectron() {
return 'electronAPI' in window && window['electronAPI'] !== undefined
return 'electronAPI' in window && window.electronAPI !== undefined
}
export function electronAPI() {
return (window as any)['electronAPI'] as ElectronAPI
return (window as any).electronAPI as ElectronAPI
}
type NativeContextOptions = Parameters<ElectronAPI['showContextMenu']>[0]
export function showNativeMenu(options?: NativeContextOptions) {
export function showNativeMenu(options?: ElectronContextMenuOptions) {
electronAPI()?.showContextMenu(options)
}