@n1k1t/mock-server
Version:
Powerful util to setup mocks over HTTP APIs
26 lines • 753 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ClientMethod = void 0;
const utils_1 = require("../../utils");
;
class ClientMethod {
constructor() {
this.handlers = (0, utils_1.cast)({
remote: () => () => Promise.reject(new Error('Not implemented')),
onsite: () => () => Promise.reject(new Error('Not implemented')),
});
}
register(type, handler) {
this.handlers[type] = handler;
return this;
}
compile(type, context) {
const handler = this.handlers[type];
return handler(context);
}
static build() {
return new ClientMethod();
}
}
exports.ClientMethod = ClientMethod;
//# sourceMappingURL=method.js.map