diff --git a/public/client.js b/public/client.js index 90ac681..0297556 100644 --- a/public/client.js +++ b/public/client.js @@ -43,7 +43,7 @@ export default class ClientList { } } channel.onmessage = event => { - console.log('对方发送', channel.label, '数据消息') + //console.log('对方发送', channel.label, '数据消息') if (option && option.onmessage) { option.onmessage(event, client) } diff --git a/public/music.js b/public/music.js index 2a6a341..050ca65 100644 --- a/public/music.js +++ b/public/music.js @@ -61,11 +61,11 @@ export default class MusicList { document.head.appendChild(style) document.body.appendChild(input) } - // 添加回调函数 - on(name, callback) { - this.EventListeners[name] = callback - } add(item) { + // 如果ID已存在则不添加 + if (this.list.find(i => i.id === item.id)) { + return + } // 将字节转换为可读的单位 const bytesToSize = bytes => { if (bytes === 0) return '0 B' @@ -163,10 +163,6 @@ export default class MusicList { async ban(item) { this.event.onban(item) } - //like(user_id, item_id) { - // //if (!item.like) item.like = [] - // //item.like.push(user_id) - //} next() { } prev() { } }