feat: updates

This commit is contained in:
qier222 2022-06-25 13:47:07 +08:00
parent f340a90117
commit cec4c5909d
No known key found for this signature in database
GPG key ID: 9C85007ED905F14D
50 changed files with 1304 additions and 207 deletions

View file

@ -3,7 +3,7 @@ import { getCoverColor } from '../utils/common'
import { useState, useEffect } from 'react'
export default function useCoverColor(url: string) {
const [color, setColor] = useState({ from: '#fff', to: '#fff' })
const [color, setColor] = useState({ from: '#000', to: '#000' })
useEffect(() => {
getCoverColor(url || '').then(color => {

View file

@ -1,12 +1,12 @@
import { IpcChannelsParams, IpcChannelsReturns } from '@/shared/IpcChannels'
import { IpcChannels, IpcChannelsReturns } from '@/shared/IpcChannels'
import { useEffect } from 'react'
const useIpcRenderer = <T extends keyof IpcChannelsParams>(
channcel: T,
const useIpcRenderer = <T extends IpcChannels>(
channel: T,
listener: (event: any, value: IpcChannelsReturns[T]) => void
) => {
useEffect(() => {
return window.ipcRenderer?.on(channcel, listener)
return window.ipcRenderer?.on(channel, listener)
}, [])
}