Category "decorator"

Typescript ClassDecorator target type

I'm writing my own decorators in typescript. Currently, my decorators look like this: const Controller = (prefix = ''): ClassDecorator => (target: any): voi

How to pass a dynamic port to the Websockets-gateway in NestJS?

I wanted to dynamically set the Websockets-gateway port from config in NestJS. Below is my websockets-gateway code. import { WebSocketGateway } from '@nestjs/we

Python 3 type hinting for decorator

Consider the following code: from typing import Callable, Any TFunc = Callable[..., Any] def get_authenticated_user(): return "John" def require_auth() ->

How to implement a parameter decorator in TypeScript?

I've been trying to use a parameter decorator @logParameter: class Person { public name: string; public surname: string; constructor(name : string, sur

toggling decorators

What's the best way to toggle decorators on and off, without actually going to each decoration and commenting it out? Say you have a benchmarking decorator: #

How to track Ajax actions via analytics function

I need to track a number of ajax-actions on my site and I have a reachGoal(TARGET_NAME) analytics function that I need insert to every function I want to track:

Python functools.wraps equivalent for classes

When defining a decorator using a class, how do I automatically transfer over__name__, __module__ and __doc__? Normally, I would use the @wraps decorator from

Decorators with parameters?

I have a problem with the transfer of the variable insurance_mode by the decorator. I would do it by the following decorator statement: @execute_complete_reserv

Python dynamic decorators - why so many wraps?

So I'm still kind of new to Python decorators - I've used them before, but I've never made my own. I'm reading this tutorial (that particular paragraph) and I d