surrogate
Version:
Object method hooks made easy
29 lines • 875 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.NextContext = void 0;
const executionContext_1 = require("./executionContext");
class NextContext extends executionContext_1.ExecutionContext {
start() {
this.runNext();
return this.complete();
}
complete() {
return this.returnValue;
}
runOriginal(node) {
const { container, context } = node;
const handler = container.getHandler(context);
const result = handler.apply(context.receiver, this.currentArgs);
this.setReturnValue(result);
this.runNext(node.nextNode);
}
bail(bailWith) {
this.setReturnValue(bailWith);
}
handleError(node, error) {
this.logError(node, error);
throw error;
}
}
exports.NextContext = NextContext;
//# sourceMappingURL=nextContext.js.map