UNPKG

siesta-lite

Version:

Stress-free JavaScript unit testing and functional testing tool, works in NodeJS and browsers

43 lines (42 loc) 1.89 kB
"use strict"; 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 Common_js_1 = require("../../../generic/util/Common.js"); var ChannelEndPoint_js_1 = require("../../../generic/channel/ChannelEndPoint.js"); var NodeJsLogger_js_1 = require("../../util/role/NodeJsLogger.js"); var ChildEndPoint = /** @class */ (function (_super) { __extends(ChildEndPoint, _super); function ChildEndPoint() { return _super !== null && _super.apply(this, arguments) || this; } ChildEndPoint.prototype.doConnect = function (channel) { process.addListener('message', this.messageListener = this.onRawChannelMessage.bind(this)); return Promise.resolve(); }; ChildEndPoint.prototype.doDisconnect = function () { this.messageListener && process.removeListener('message', this.messageListener); }; ChildEndPoint.prototype.sendMessage = function (message) { process.send(message); }; ChildEndPoint.prototype.messageToEnvelop = function (message) { return message; }; ChildEndPoint.prototype.envelopToMessage = function (envelop) { return envelop; }; return ChildEndPoint; }(ChannelEndPoint_js_1.ChannelEndPoint(NodeJsLogger_js_1.NodeJsLogger(Common_js_1.Base)))); exports.ChildEndPoint = ChildEndPoint;