Conditions | 1 |
Total Lines | 15 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 5 |
CRAP Score | 1 |
Changes | 0 |
1 | import { ExpressBean } from '@/ExpressBeansTypes'; |
||
3 | |||
4 | /** |
||
5 | * Hook a function to initialization phase. |
||
6 | * @decorator |
||
7 | */ |
||
8 | export function Setup<This>( |
||
9 | method: () => any, |
||
10 | context: ClassMethodDecoratorContext<This, () => any>, |
||
11 | ) { |
||
12 | 2 | setImmediate(() => { |
|
13 | 2 | const bean = registeredMethods.get(method) as ExpressBean; |
|
14 | 2 | logger.debug(`Running setup function ${bean.className}.${String(context.name)}`); |
|
15 | 2 | method.bind(bean)(); |
|
16 | }); |
||
17 | 2 | return method; |
|
18 | } |
||
19 |