From c56946f4d10e46adb3e67d9646adcf32581c72b5 Mon Sep 17 00:00:00 2001 From: isaacs Date: Mon, 26 Mar 2012 12:28:47 -0700 Subject: [PATCH] Add .abort() method --- lib/abstract.js | 5 +++++ lib/reader.js | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/abstract.js b/lib/abstract.js index add48b9..5675d4a 100644 --- a/lib/abstract.js +++ b/lib/abstract.js @@ -20,6 +20,11 @@ Abstract.prototype.on = function (ev, fn) { return this } +Abstract.prototype.abort = function () { + this._aborted = true + this.emit("abort") +} + Abstract.prototype.destroy = function () {} Abstract.prototype.warn = function (msg, code) { diff --git a/lib/reader.js b/lib/reader.js index 732eb68..4552013 100644 --- a/lib/reader.js +++ b/lib/reader.js @@ -191,7 +191,7 @@ Reader.prototype._stat = function (currentStat) { // special handling for ProxyReaders if (!me.filter.call(who, who, props)) { if (!me._disowned) { - me._aborted = true + me.abort() me.emit("end") me.emit("close") }