mirror of
https://github.com/schlagmichdoch/PairDrop.git
synced 2026-04-21 22:54:53 +08:00
only show Peer when p2p channel is opened to prevent sending without open channel -> Improve stability
This commit is contained in:
@@ -26,8 +26,6 @@ class PeersUI {
|
||||
_onPeerJoined(peer) {
|
||||
if ($(peer.id)) return; // peer already exists
|
||||
const peerUI = new PeerUI(peer);
|
||||
$$('x-peers').appendChild(peerUI.$el);
|
||||
setTimeout(e => window.animateBackground(false), 1750); // Stop animation
|
||||
}
|
||||
|
||||
_onPeers(peers) {
|
||||
@@ -91,8 +89,18 @@ class PeerUI {
|
||||
|
||||
constructor(peer) {
|
||||
this._peer = peer;
|
||||
this._initDom();
|
||||
this._bindListeners(this.$el);
|
||||
this.callbackFunction = (e) => this._onPeerConnected(e.detail);
|
||||
Events.on('peer-connected', this.callbackFunction);
|
||||
}
|
||||
|
||||
_onPeerConnected(peerId) {
|
||||
if (peerId === this._peer.id) {
|
||||
Events.off('peer-connected', this.callbackFunction)
|
||||
this._initDom();
|
||||
this._bindListeners(this.$el);
|
||||
$$('x-peers').appendChild(this.$el);
|
||||
setTimeout(e => window.animateBackground(false), 1750); // Stop animation
|
||||
}
|
||||
}
|
||||
|
||||
_initDom() {
|
||||
|
||||
Reference in New Issue
Block a user