UNPKG

nestjs-aop

Version:

<!-- PROJECT LOGO --> <br /> <div align="center"> <a href="https://github.com/toss/nestjs-aop"> <img src="https://toss.tech/wp-content/uploads/2022/11/tech-article-nest-js-02.png" alt="Logo" height="200"> </a>

36 lines (31 loc) 853 B
import { Injectable } from '@nestjs/common'; import { Foo, NotAopFoo, SetOriginalTrue } from './foo.decorator'; @Injectable() export class FooService { @Foo({ options: 'options' }) @SetOriginalTrue() foo(arg1: string, arg2: number) { return arg1 + arg2; } @Foo({ options: '0' }) @Foo({ options: '1' }) @NotAopFoo({ options: '2' }) @Foo({ options: '3' }) @NotAopFoo({ options: '4' }) @NotAopFoo({ options: '5' }) @Foo({ options: '6' }) @Foo({ options: '7' }) multipleDecorated(arg1: string, arg2: number) { return arg1 + arg2; } async getFoo(id: number) { await new Promise((resolve) => setTimeout(resolve, 1000)); return 'foo' + id; } @Foo({ options: '1' }) thisTest() { // eslint-disable-next-line @typescript-eslint/no-this-alias fooThisValue = this; } } export let fooThisValue: any;