@chix/flow
Version:
47 lines • 1.86 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 });
var _debug = require("debug");
var events_1 = require("../events");
var debug = _debug('chix:io');
function $Disconnect(Base) {
return (function (_super) {
__extends(Disconnect$, _super);
function Disconnect$() {
return _super !== null && _super.apply(this, arguments) || this;
}
Disconnect$.prototype.disconnect = function (link) {
if (this.connections.has(link.ioid)) {
this.connections.delete(link.ioid);
}
else {
throw Error('Cannot disconnect an unknown connection');
}
if (this.syncedTargetMap.has(link.target.pid)) {
this.removeSyncedTarget(link);
}
if (this.pointerPorts.has(link.source.pid)) {
this.removePointerPort(link);
}
debug('%s: disconnected', link.ioid);
delete link.ioid;
link.source.removeListener(events_1.ConnectorEvents.DATA, this.onDataHandler);
this.emit(events_1.IOEvents.DISCONNECT, link);
};
return Disconnect$;
}(Base));
}
exports.$Disconnect = $Disconnect;
//# sourceMappingURL=disconnect.js.map