blob: a966c3c71668657f3e7a1d8591ec1aaea40885c9 [file] [log] [blame]
(function() {
var EventEmitter, PushTransfer,
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
EventEmitter = require('events').EventEmitter;
PushTransfer = (function(_super) {
__extends(PushTransfer, _super);
function PushTransfer() {
this._stack = [];
this.stats = {
bytesTransferred: 0
};
}
PushTransfer.prototype.cancel = function() {
return this.emit('cancel');
};
PushTransfer.prototype.push = function(byteCount) {
return this._stack.push(byteCount);
};
PushTransfer.prototype.pop = function() {
var byteCount;
byteCount = this._stack.pop();
this.stats.bytesTransferred += byteCount;
return this.emit('progress', this.stats);
};
PushTransfer.prototype.end = function() {
return this.emit('end');
};
return PushTransfer;
})(EventEmitter);
module.exports = PushTransfer;
}).call(this);