-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathusage2.ts
More file actions
28 lines (23 loc) · 651 Bytes
/
usage2.ts
File metadata and controls
28 lines (23 loc) · 651 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import { engine, EngineTask, run } from '../src';
import { writeTrace } from './common/writeTrace';
@engine({ id: 'uniqueEngineId' })
class MyClass extends EngineTask {
@run()
myMethod1(param: string) {
return `result1 for ${param}`;
}
@run()
async myMethod2(param: string) {
return `result2 for ${param}`;
}
}
export async function generate() {
const myInstance = new MyClass();
myInstance.myMethod1('param1');
await myInstance.myMethod2('param2');
// Retrieve the trace
const trace = myInstance.engine.getTrace();
const jsonString = JSON.stringify(trace, null, 2);
writeTrace(jsonString);
}
generate().then();