rpc-typescript
Version:
An RCP library for TypeScript
23 lines (17 loc) • 596 B
text/typescript
import { StubContext } from "../core/StubContext";
import { StubMethodConfig } from "../types";
export function StubMethod(config?: StubMethodConfig): MethodDecorator {
const props = config ?? {
transport: 'http',
httpMethod: 'POST'
};
return (target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<any>) => {
const ctx = StubContext.getContext(props.contextDomain);
return ctx.defineMember(
props,
target,
propertyKey,
descriptor
);
}
}