Преглед изворни кода

added method Peer.isConnected()

Matthias Lohr пре 12 година
родитељ
комит
bf4e695077
1 измењених фајлова са 8 додато и 0 уклоњено
  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;