Skip to content

Args

@tsed/socketio

Usage

typescript
import { Args } from "@tsed/socketio";

See /packages/third-parties/socketio/src/types/decorators/args.ts.

Overview

ts
function Args(mapIndex?: number, useType?: any): any;

Description

Inject the list of arguments in the decorated parameter.

@Args accept an index parameter to pick up directly the item in the arguments list.

Example

typescript
@SocketService("/nsp")
export class MyWS {

  @Input("event")
  myMethod(@Args() arguments: any[]) {

  }

  @Input("event2")
  myMethod2(@Args(0) data: any) {

  }
}

Released under the MIT License.