UNPKG

rpc-typescript

Version:
23 lines (17 loc) 596 B
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 ); } }