@firaenix/bittorrent-protocol
Version:
Simple, robust, BitTorrent peer wire protocol implementation
42 lines (41 loc) • 1.54 kB
JavaScript
;
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.EventExtension = exports.Extension = void 0;
var tiny_typed_emitter_1 = require("tiny-typed-emitter");
var Extension = /** @class */ (function () {
function Extension(wire) {
var _this = this;
this.sendExtendedMessage = function (data) {
_this.wire.extended(_this.name, data);
};
this.wire = wire;
}
return Extension;
}());
exports.Extension = Extension;
var EventExtension = /** @class */ (function (_super) {
__extends(EventExtension, _super);
function EventExtension(wire) {
var _this = _super.call(this) || this;
_this.sendExtendedMessage = function (data) {
_this.wire.extended(_this.name, data);
};
_this.wire = wire;
return _this;
}
return EventExtension;
}(tiny_typed_emitter_1.TypedEmitter));
exports.EventExtension = EventExtension;