更新 Electron API 类型声明,添加身份证监听相关方法,并修改 Window 接口以确保 electronAPI 不可选
This commit is contained in:
13
src/electron.d.ts
vendored
13
src/electron.d.ts
vendored
@@ -1,10 +1,17 @@
|
|||||||
// Electron API 类型声明
|
// Electron API 类型声明
|
||||||
interface ElectronAPI {
|
interface ElectronAPI {
|
||||||
fetchPdf: (pdfUrl: string) => Promise<{ success: boolean; data?: string; error?: string }>;
|
fetchPdf: (
|
||||||
|
pdfUrl: string
|
||||||
|
) => Promise<{ success: boolean; data?: string; error?: string }>;
|
||||||
printPdf: (pdfUrl: string) => Promise<{ success: boolean; error?: string }>;
|
printPdf: (pdfUrl: string) => Promise<{ success: boolean; error?: string }>;
|
||||||
|
startIdCardListen: () => Promise<any>;
|
||||||
|
stopIdCardListen: () => Promise<any>;
|
||||||
|
onIdCardData: (callback: (data: any) => void) => void;
|
||||||
|
onIdCardError: (callback: (error: any) => void) => void;
|
||||||
|
log: (level: string, message: any) => void;
|
||||||
|
removeIdCardListeners: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Window {
|
interface Window {
|
||||||
electronAPI?: ElectronAPI;
|
electronAPI: ElectronAPI;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
11
src/vite-env.d.ts
vendored
11
src/vite-env.d.ts
vendored
@@ -1,12 +1 @@
|
|||||||
/// <reference types="vite/client" />
|
/// <reference types="vite/client" />
|
||||||
|
|
||||||
interface Window {
|
|
||||||
electronAPI: {
|
|
||||||
startIdCardListen: () => Promise<any>;
|
|
||||||
stopIdCardListen: () => Promise<any>;
|
|
||||||
onIdCardData: (callback: (data: any) => void) => void;
|
|
||||||
onIdCardError: (callback: (error: any) => void) => void;
|
|
||||||
log: (level: string, message: any) => void;
|
|
||||||
removeIdCardListeners: () => void;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user