Files
yuanhe-checkin-electron/src/electron.d.ts

47 lines
1.3 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// Electron API 类型声明
interface ElectronPrinterInfo {
name: string;
displayName?: string;
description?: string;
status?: number;
isDefault?: boolean;
options?: Record<string, string>;
}
interface ElectronAPI {
fetchPdf: (
pdfUrl: string
) => Promise<{ success: boolean; data?: string; error?: string }>;
printPdf: (
pdfUrl: string,
options?: { printerName?: string; duplex?: boolean }
) => Promise<{ success: boolean; error?: string }>;
getPrinters: () => Promise<{
success: boolean;
printers?: ElectronPrinterInfo[];
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;
restartApp: () => void;
quitApp: () => void;
// 读取本地文件并返回 base64如果失败返回 { success:false, error }
readLocalFile: (
filePath: string
) => Promise<{
success: boolean;
data?: string;
mime?: string;
error?: string;
}>;
// 成功时返回 { success:true, data: base64String, mime?: mimeType }
}
interface Window {
electronAPI: ElectronAPI;
}