Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

implement connect (consistent with net) and destroy (necessary for wr…

…itable streams)
  • Loading branch information...
commit c4337c2cf27191529add837aa4efc7b43605e4dc 1 parent 6ba04ff
Dominic Tarr dominictarr authored
Showing with 8 additions and 0 deletions.
  1. +8 −0 browser.js
8 browser.js
View
@@ -35,10 +35,18 @@ module.exports = function (uri, cb) {
stream.writable = false;
sock.close();
};
+
+ stream.destroy = function () {
+ stream._ended = true;
+ stream.writable = stream.readable = false;
+ buffer.length = 0
+ sock.close();
+ }
sock.onopen = function () {
if (typeof cb === 'function') cb();
ready = true;
+ stream.emit('connect')
buffer.forEach(function (msg) {
sock.send(msg);
});
Please sign in to comment.
Something went wrong with that request. Please try again.