YesPlayMusic/packages/shared/IpcChannels.ts

99 lines
2.8 KiB
TypeScript
Raw Normal View History

2022-07-12 22:42:50 +08:00
import { AppleMusicAlbum, AppleMusicArtist } from './AppleMusic'
2023-01-28 11:54:57 +08:00
import { CacheAPIs } from './CacheAPIs'
import { RepeatMode } from './playerDataTypes'
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',
2022-08-03 23:48:39 +08:00
FullscreenStateChange = 'FullscreenStateChange',
2022-10-28 20:29:04 +08:00
GetApiCache = 'GetApiCache',
2022-05-13 18:18:28 +08:00
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-05-29 17:53:27 +08:00
ResetWindowSize = 'ResetWindowSize',
2022-07-12 22:42:50 +08:00
GetAlbumFromAppleMusic = 'GetAlbumFromAppleMusic',
GetArtistFromAppleMusic = 'GetArtistFromAppleMusic',
2022-10-28 20:29:04 +08:00
Logout = 'Logout',
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
2022-08-03 23:48:39 +08:00
[IpcChannels.FullscreenStateChange]: void
2022-10-28 20:29:04 +08:00
[IpcChannels.GetApiCache]: {
2023-01-28 11:54:57 +08:00
api: CacheAPIs
2022-04-16 21:14:03 +08:00
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-07-11 11:06:41 +08:00
[IpcChannels.SyncSettings]: any
2022-05-13 18:18:28 +08:00
[IpcChannels.GetAudioCacheSize]: void
2022-05-29 17:53:27 +08:00
[IpcChannels.ResetWindowSize]: void
2022-07-12 22:42:50 +08:00
[IpcChannels.GetAlbumFromAppleMusic]: {
id: number
name: string
artist: string
}
[IpcChannels.GetArtistFromAppleMusic]: { id: number; name: string }
2022-10-28 20:29:04 +08:00
[IpcChannels.Logout]: 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
2022-08-03 23:48:39 +08:00
[IpcChannels.FullscreenStateChange]: boolean
2022-10-28 20:29:04 +08:00
[IpcChannels.GetApiCache]: any
2022-04-16 21:14:03 +08:00
[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-07-12 22:42:50 +08:00
[IpcChannels.GetAlbumFromAppleMusic]: AppleMusicAlbum | undefined
[IpcChannels.GetArtistFromAppleMusic]: AppleMusicArtist | undefined
2022-10-28 20:29:04 +08:00
[IpcChannels.Logout]: void
2022-04-16 21:14:03 +08:00
}