YesPlayMusic/packages/web/global.d.ts

43 lines
1.0 KiB
TypeScript
Raw Normal View History

2022-04-16 21:14:03 +08:00
import { IpcChannelsParams, IpcChannelsReturns } from '@/shared/IpcChannels'
2022-04-16 13:30:25 +08:00
import { ElectronLog } from 'electron-log'
2022-04-09 00:28:37 +08:00
2022-03-13 14:40:38 +08:00
export {}
declare global {
interface Window {
2022-04-09 00:28:37 +08:00
ipcRenderer?: {
2022-04-16 21:14:03 +08:00
sendSync: <T extends keyof IpcChannelsParams>(
channel: T,
params?: IpcChannelsParams[T]
) => IpcChannelsReturns[T]
2022-06-12 15:29:14 +08:00
invoke: <T extends keyof IpcChannelsParams>(
channel: T,
params?: IpcChannelsParams[T]
) => Promise<IpcChannelsReturns[T]>
2022-04-16 21:14:03 +08:00
send: <T extends keyof IpcChannelsParams>(
channel: T,
params?: IpcChannelsParams[T]
) => void
on: <T extends keyof IpcChannelsParams>(
channel: T,
listener: (
event: Electron.IpcRendererEvent,
value: IpcChannelsReturns[T]
) => void
2022-04-09 00:28:37 +08:00
) => void
}
2022-04-04 17:51:07 +08:00
env?: {
isElectron: boolean
isEnableTitlebar: boolean
2022-04-04 17:51:07 +08:00
isLinux: boolean
isMac: boolean
isWindows: boolean
2022-04-04 17:51:07 +08:00
}
2022-04-16 13:30:25 +08:00
log?: ElectronLog
2022-03-13 14:40:38 +08:00
}
}
declare module 'valtio' {
function useSnapshot<T extends object>(p: T): T
}