2025-01-01 02:25:18 +08:00
|
|
|
import { ElectronAPI } from '@electron-toolkit/preload';
|
|
|
|
|
|
2025-04-12 23:16:12 +08:00
|
|
|
interface API {
|
|
|
|
|
minimize: () => void;
|
|
|
|
|
maximize: () => void;
|
|
|
|
|
close: () => void;
|
|
|
|
|
dragStart: (data: any) => void;
|
|
|
|
|
miniTray: () => void;
|
|
|
|
|
miniWindow: () => void;
|
|
|
|
|
restore: () => void;
|
|
|
|
|
restart: () => void;
|
|
|
|
|
resizeWindow: (width: number, height: number) => void;
|
|
|
|
|
resizeMiniWindow: (showPlaylist: boolean) => void;
|
|
|
|
|
openLyric: () => void;
|
|
|
|
|
sendLyric: (data: any) => void;
|
|
|
|
|
sendSong: (data: any) => void;
|
2025-04-22 23:39:08 +08:00
|
|
|
unblockMusic: (id: number, data: any, enabledSources?: string[]) => Promise<any>;
|
2025-04-12 23:16:12 +08:00
|
|
|
onLyricWindowClosed: (callback: () => void) => void;
|
|
|
|
|
startDownload: (url: string) => void;
|
|
|
|
|
onDownloadProgress: (callback: (progress: number, status: string) => void) => void;
|
|
|
|
|
onDownloadComplete: (callback: (success: boolean, filePath: string) => void) => void;
|
|
|
|
|
onLanguageChanged: (callback: (locale: string) => void) => void;
|
|
|
|
|
removeDownloadListeners: () => void;
|
2025-09-09 22:05:48 +08:00
|
|
|
importCustomApiPlugin: () => Promise<{ name: string; content: string } | null>;
|
2025-04-12 23:16:12 +08:00
|
|
|
invoke: (channel: string, ...args: any[]) => Promise<any>;
|
2025-09-10 01:11:06 +08:00
|
|
|
getSearchSuggestions: (keyword: string) => Promise<any>;
|
2025-04-12 23:16:12 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 自定义IPC渲染进程通信接口
|
|
|
|
|
interface IpcRenderer {
|
|
|
|
|
send: (channel: string, ...args: any[]) => void;
|
|
|
|
|
invoke: (channel: string, ...args: any[]) => Promise<any>;
|
|
|
|
|
on: (channel: string, listener: (...args: any[]) => void) => () => void;
|
|
|
|
|
removeAllListeners: (channel: string) => void;
|
|
|
|
|
}
|
|
|
|
|
|
2025-01-01 02:25:18 +08:00
|
|
|
declare global {
|
|
|
|
|
interface Window {
|
|
|
|
|
electron: ElectronAPI;
|
2025-04-12 23:16:12 +08:00
|
|
|
api: API;
|
|
|
|
|
ipcRenderer: IpcRenderer;
|
2025-01-10 22:49:55 +08:00
|
|
|
$message: any;
|
2025-01-01 02:25:18 +08:00
|
|
|
}
|
|
|
|
|
}
|