YesPlayMusic/packages/shared/IpcChannels.ts

81 lines
2.1 KiB
TypeScript
Raw Normal View History

2022-04-16 21:14:03 +08:00
import { APIs } from './CacheAPIs'
import { RepeatMode } from './playerDataTypes'
2022-05-01 19:53:25 +08:00
import { Store } from '@/shared/store'
2022-04-16 21:14:03 +08:00
export const enum IpcChannels {
2022-05-13 18:18:28 +08:00
ClearAPICache = 'ClearAPICache',
Minimize = 'Minimize',
MaximizeOrUnmaximize = 'MaximizeOrUnmaximize',
Close = 'Close',
IsMaximized = 'IsMaximized',
GetApiCacheSync = 'GetApiCacheSync',
DevDbExportJson = 'DevDbExportJson',
CacheCoverColor = 'CacheCoverColor',
SetTrayTooltip = 'SetTrayTooltip',
// 准备三个播放相关channel, 为 mpris 预留接口
2022-05-13 18:18:28 +08:00
Play = 'Play',
Pause = 'Pause',
PlayOrPause = 'PlayOrPause',
Next = 'Next',
Previous = 'Previous',
Like = 'Like',
Repeat = 'Repeat',
SyncSettings = 'SyncSettings',
GetAudioCacheSize = 'GetAudioCacheSize',
2022-04-16 21:14:03 +08:00
}
// ipcMain.on params
2022-04-16 21:14:03 +08:00
export interface IpcChannelsParams {
[IpcChannels.ClearAPICache]: void
[IpcChannels.Minimize]: void
[IpcChannels.MaximizeOrUnmaximize]: void
[IpcChannels.Close]: void
[IpcChannels.IsMaximized]: void
[IpcChannels.GetApiCacheSync]: {
api: APIs
query?: any
}
[IpcChannels.DevDbExportJson]: void
[IpcChannels.CacheCoverColor]: {
id: number
color: string
}
[IpcChannels.SetTrayTooltip]: {
text: string
}
[IpcChannels.Play]: void
[IpcChannels.Pause]: void
[IpcChannels.PlayOrPause]: void
[IpcChannels.Next]: void
[IpcChannels.Previous]: void
[IpcChannels.Like]: {
isLiked: boolean
}
[IpcChannels.Repeat]: {
mode: RepeatMode
}
2022-05-01 19:53:25 +08:00
[IpcChannels.SyncSettings]: Store['settings']
2022-05-13 18:18:28 +08:00
[IpcChannels.GetAudioCacheSize]: void
2022-04-16 21:14:03 +08:00
}
// ipcRenderer.on params
2022-04-16 21:14:03 +08:00
export interface IpcChannelsReturns {
[IpcChannels.ClearAPICache]: void
[IpcChannels.Minimize]: void
[IpcChannels.MaximizeOrUnmaximize]: void
[IpcChannels.Close]: void
[IpcChannels.IsMaximized]: boolean
[IpcChannels.GetApiCacheSync]: any
[IpcChannels.DevDbExportJson]: void
[IpcChannels.CacheCoverColor]: void
[IpcChannels.SetTrayTooltip]: void
[IpcChannels.Play]: void
[IpcChannels.Pause]: void
[IpcChannels.PlayOrPause]: void
[IpcChannels.Next]: void
[IpcChannels.Previous]: void
[IpcChannels.Like]: void
[IpcChannels.Repeat]: RepeatMode
2022-05-13 18:18:28 +08:00
[IpcChannels.GetAudioCacheSize]: void
2022-04-16 21:14:03 +08:00
}