mirror of
https://github.com/GiriNeko/YesPlayMusic.git
synced 2025-12-17 13:48:02 +00:00
feat: monorepo
This commit is contained in:
parent
4d54060a4f
commit
42089d4996
200 changed files with 1530 additions and 1521 deletions
13
packages/web/hooks/useIpcRenderer.ts
Normal file
13
packages/web/hooks/useIpcRenderer.ts
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
import { IpcChannelsParams, IpcChannelsReturns } from '@/shared/IpcChannels'
|
||||
import { useEffect } from 'react'
|
||||
|
||||
const useIpcRenderer = <T extends keyof IpcChannelsParams>(
|
||||
channcel: T,
|
||||
listener: (event: any, value: IpcChannelsReturns[T]) => void
|
||||
) => {
|
||||
useEffect(() => {
|
||||
return window.ipcRenderer?.on(channcel, listener)
|
||||
}, [])
|
||||
}
|
||||
|
||||
export default useIpcRenderer
|
||||
Loading…
Add table
Add a link
Reference in a new issue