All files description.ts

92.59% Statements 25/27
100% Branches 4/4
50% Functions 1/2
92.59% Lines 25/27

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 271x 1x 1x 1x 1x 1x 1x 1x 1x 5x 5x 5x 3x 3x 3x 3x 3x 3x 5x 5x 5x 1x 1x 1x     1x
 
/**
 * Specify the discoverability of a registered service. When true (default), the session's
 * `discoverServices()` call will return an entry for this service. When false,
 * the service will not be listed.
 * 
 * @param discoverable Whether the service should be discoverable
 * @returns 
 */
export function Description(description: string) {
    return (target, propertyKey?: string, paramIndex?: number | PropertyDescriptor) => {
        if (typeof paramIndex === 'number') {
            if (!Reflect.hasMetadata('rpc:paramDescriptions', target, propertyKey))
                Reflect.defineMetadata('rpc:paramDescriptions', [], target, propertyKey);
 
            let paramDescriptions = Reflect.getMetadata('rpc:paramDescriptions', target, propertyKey);
            paramDescriptions[paramIndex] = description;
        }
        Reflect.defineMetadata('rpc:description', description, target, propertyKey);
    }
}
 
class Foo {
    bar(@Description('blah') cool: number) {

    }
}