UNPKG

713 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.WebSocketGateway = void 0;
4const constants_1 = require("../constants");
5function WebSocketGateway(portOrOptions, options) {
6 const isPortInt = Number.isInteger(portOrOptions);
7 // eslint-disable-next-line prefer-const
8 let [port, opt] = isPortInt ? [portOrOptions, options] : [0, portOrOptions];
9 opt = opt || {};
10 return (target) => {
11 Reflect.defineMetadata(constants_1.GATEWAY_METADATA, true, target);
12 Reflect.defineMetadata(constants_1.PORT_METADATA, port, target);
13 Reflect.defineMetadata(constants_1.GATEWAY_OPTIONS, opt, target);
14 };
15}
16exports.WebSocketGateway = WebSocketGateway;