移除多余代码
parent
26369dd14b
commit
583e8c43d6
|
@ -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)
|
||||
})
|
||||
}
|
||||
|
|
|
@ -15,7 +15,6 @@ const names = {
|
|||
setTogglePlay: 'setTogglePlay',
|
||||
setProgress: 'setProgress',
|
||||
play: 'play',
|
||||
setPlay: 'setPlay',
|
||||
pause: 'pause',
|
||||
setPause: 'setPause',
|
||||
stop: 'stop',
|
||||
|
|
Loading…
Reference in New Issue