all files / core/decorators/ timeout-decorator.ts

100% Statements 8/8
100% Branches 2/2
100% Functions 2/2
100% Lines 7/7
1 2 3 4 5 6 7 8 9 10 11 12 13 14              
import "reflect-metadata";
import { TIMEOUT } from "./_metadata-keys";
 
export function Timeout(timeoutInMs: number) {
  if (timeoutInMs <= 0) {
     throw new RangeError("Timeout period must be greater than 0.");
  }
 
  return (target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<any>) => {
 
    Reflect.defineMetadata(TIMEOUT, timeoutInMs, target, propertyKey);
  };
}