diff --git a/src/renderer/core/useApp/usePlayer/useLyric.js b/src/renderer/core/useApp/usePlayer/useLyric.js index 6bfe94ac..d9740e22 100644 --- a/src/renderer/core/useApp/usePlayer/useLyric.js +++ b/src/renderer/core/useApp/usePlayer/useLyric.js @@ -26,7 +26,7 @@ export default ({ setting }) => { }) - const setPlayInfo = musicInfo => { + const setPlayInfo = ({ musicInfo }) => { setDesktopLyricInfo('music_info', { songmid: musicInfo.songmid, singer: musicInfo.singer, @@ -50,10 +50,6 @@ export default ({ setting }) => { } } - const handleSetPlayInfo = ({ musicInfo }) => { - setPlayInfo(musicInfo) - } - const handlePlay = () => { if (!musicInfo.lrc) return const currentTime = getCurrentTime() * 1000 @@ -104,22 +100,20 @@ export default ({ setting }) => { }) - window.eventHub.on(player.setPlay, setPlayInfo) window.eventHub.on(player.play, handlePlay) window.eventHub.on(player.pause, handlePause) window.eventHub.on(player.stop, handleStop) window.eventHub.on(player.error, handlePause) - window.eventHub.on(player.setPlayInfo, handleSetPlayInfo) + window.eventHub.on(player.setPlayInfo, setPlayInfo) window.eventHub.on(player.updateLyric, setLyric) onBeforeUnmount(() => { rGetDesktopLyricInfo() - window.eventHub.off(player.setPlay, setPlayInfo) window.eventHub.off(player.play, handlePlay) window.eventHub.off(player.pause, handlePause) window.eventHub.off(player.stop, handleStop) window.eventHub.off(player.error, handlePause) - window.eventHub.off(player.setPlayInfo, handleSetPlayInfo) + window.eventHub.off(player.setPlayInfo, setPlayInfo) window.eventHub.off(player.updateLyric, setLyric) }) } diff --git a/src/renderer/event/names.js b/src/renderer/event/names.js index 909fca95..3917a9a2 100644 --- a/src/renderer/event/names.js +++ b/src/renderer/event/names.js @@ -15,7 +15,6 @@ const names = { setTogglePlay: 'setTogglePlay', setProgress: 'setProgress', play: 'play', - setPlay: 'setPlay', pause: 'pause', setPause: 'setPause', stop: 'stop',