-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathusage.ts
More file actions
19 lines (14 loc) · 536 Bytes
/
usage.ts
File metadata and controls
19 lines (14 loc) · 536 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import { ExecutionEngine } from '../src';
import { writeTrace } from './common/writeTrace';
export async function run() {
const engine = new ExecutionEngine();
// for sync functions:
const res1 = engine.run((param) => `result1 for ${param}`, ['param1']);
// for async functions:
const res2 = await engine.run(async (param) => `result2 for ${param}`, [res1.outputs]);
// Retrieve the trace
const trace = engine.getTrace();
const jsonString = JSON.stringify(trace, null, 2);
writeTrace(jsonString);
}
run().then();