Răsfoiți Sursa

added method Peer.isConnected()

Matthias Lohr 12 ani în urmă
părinte
comite
bf4e695077
1 a modificat fișierele cu 8 adăugiri și 0 ștergeri
  1. 8 0
      lib/peer.js

+ 8 - 0
lib/peer.js

@@ -301,5 +301,13 @@ Peer.prototype.disconnect = function() {
   }
 };
 
+/**
+ * Provides a clean method for checking if there's an active connection to the
+ * peer server.
+ */
+Peer.prototype.isConnected = function() {
+  return (!this.disconnected);
+}
+
 
 exports.Peer = Peer;