siesta-lite
Version:
Stress-free JavaScript unit testing and functional testing tool, works in NodeJS and browsers
52 lines (51 loc) • 2.22 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 NodeJsPageRpc_js_1 = require("./NodeJsPageRpc.js");
var ParentEndPoint_js_1 = require("../channel/ipc/ParentEndPoint.js");
var NodeJsPageParentEndPoint = /** @class */ (function (_super) {
__extends(NodeJsPageParentEndPoint, _super);
function NodeJsPageParentEndPoint() {
return _super !== null && _super.apply(this, arguments) || this;
}
NodeJsPageParentEndPoint.prototype.doConnect = function (channel) {
var _this = this;
if (this.connectResolve)
throw new Error("Already connecting");
return new Promise(function (resolve, reject) {
return _super.prototype.doConnect.call(_this, channel).then(function () {
_this.connectResolve = resolve;
_this.connectReject = reject;
});
});
};
NodeJsPageParentEndPoint.prototype.doProcessRawChannelMessage = function (message, envelop) {
this.debug("Parent received message: " + message);
if (message === NodeJsPageRpc_js_1.NodeJsIpcClienState.Ready) {
var resolve = this.connectResolve;
this.connectResolve = null;
this.connectReject = null;
resolve();
}
};
NodeJsPageParentEndPoint.prototype.doDispatchEnvelop = function (envelop) {
var payload = envelop.payload;
// if (payload.type === NodeJsIpcRpc.FunctionCall) {
//
// }
};
return NodeJsPageParentEndPoint;
}(ParentEndPoint_js_1.ParentEndPoint));
exports.NodeJsPageParentEndPoint = NodeJsPageParentEndPoint;
;