diff --git a/package-lock.json b/package-lock.json index fa5ea07e7..577746b8a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -28,6 +28,7 @@ "devDependencies": { "@babel/core": "^7.24.7", "@babel/preset-env": "^7.22.20", + "@comfyorg/comfyui-electron-types": "^0.2.9", "@eslint/js": "^9.8.0", "@iconify/json": "^2.2.245", "@pinia/testing": "^0.1.5", @@ -1910,6 +1911,13 @@ "integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==", "dev": true }, + "node_modules/@comfyorg/comfyui-electron-types": { + "version": "0.2.9", + "resolved": "https://registry.npmjs.org/@comfyorg/comfyui-electron-types/-/comfyui-electron-types-0.2.9.tgz", + "integrity": "sha512-wXmeGrQnuiEXlUkWDAnfkPgb8YTICX8EsNKSIWDb5uMSx46fW8gJQjTc1ehawV/fw1MmuqjhOpw+rV1f2+DAtw==", + "dev": true, + "license": "GPL-3.0-only" + }, "node_modules/@comfyorg/litegraph": { "version": "0.8.21", "resolved": "https://registry.npmjs.org/@comfyorg/litegraph/-/litegraph-0.8.21.tgz", diff --git a/package.json b/package.json index edccf75f4..d8bc437f1 100644 --- a/package.json +++ b/package.json @@ -26,6 +26,7 @@ "devDependencies": { "@babel/core": "^7.24.7", "@babel/preset-env": "^7.22.20", + "@comfyorg/comfyui-electron-types": "^0.2.9", "@eslint/js": "^9.8.0", "@iconify/json": "^2.2.245", "@pinia/testing": "^0.1.5", diff --git a/src/utils/envUtil.ts b/src/utils/envUtil.ts index 4386dccd8..c656a6711 100644 --- a/src/utils/envUtil.ts +++ b/src/utils/envUtil.ts @@ -1,3 +1,9 @@ +import { ElectronAPI } from '@comfyorg/comfyui-electron-types' + export function isElectron() { return 'electronAPI' in window && window['electronAPI'] !== undefined } + +export function electronAPI() { + return window['electronAPI'] as ElectronAPI +}