mirror of
https://github.com/schlagmichdoch/PairDrop.git
synced 2025-04-21 07:16:18 -04:00
tidy up clearPeers method
This commit is contained in:
parent
f462f55abd
commit
efb3857bd2
1 changed files with 2 additions and 5 deletions
|
@ -25,7 +25,7 @@ class PeersUI {
|
||||||
Events.on('peers', e => this._onPeers(e.detail));
|
Events.on('peers', e => this._onPeers(e.detail));
|
||||||
Events.on('file-progress', e => this._onFileProgress(e.detail));
|
Events.on('file-progress', e => this._onFileProgress(e.detail));
|
||||||
Events.on('paste', e => this._onPaste(e));
|
Events.on('paste', e => this._onPaste(e));
|
||||||
Events.on('ws-disconnected', _ => this._clearPeers('all', false));
|
Events.on('ws-disconnected', _ => this._clearPeers());
|
||||||
Events.on('secret-room-deleted', _ => this._clearPeers('secret'));
|
Events.on('secret-room-deleted', _ => this._clearPeers('secret'));
|
||||||
this.peers = {};
|
this.peers = {};
|
||||||
}
|
}
|
||||||
|
@ -99,7 +99,7 @@ class PeersUI {
|
||||||
$peer.ui.setProgress(progress.progress);
|
$peer.ui.setProgress(progress.progress);
|
||||||
}
|
}
|
||||||
|
|
||||||
_clearPeers(roomType = 'all', restartAnimation = true) {
|
_clearPeers(roomType = 'all') {
|
||||||
for (const peerId in this.peers) {
|
for (const peerId in this.peers) {
|
||||||
if (roomType === 'all' || this.peers[peerId].roomType === roomType) {
|
if (roomType === 'all' || this.peers[peerId].roomType === roomType) {
|
||||||
const peerNode = $(peerId);
|
const peerNode = $(peerId);
|
||||||
|
@ -107,9 +107,6 @@ class PeersUI {
|
||||||
delete this.peers[peerId];
|
delete this.peers[peerId];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (restartAnimation && $$('x-peers').innerHTML === '') {
|
|
||||||
setTimeout(_ => window.animateBackground(true), 1750); // Start animation again
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_getPeers() {
|
_getPeers() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue