-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexecuteStep.ts
More file actions
37 lines (29 loc) · 861 Bytes
/
executeStep.ts
File metadata and controls
37 lines (29 loc) · 861 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
29
30
31
32
33
34
35
36
37
export const executeSteppes = new Map<string, ExecuteStep | { name: string, method: (c) => any }>()
export class ExecuteStep {
public name: string
public constructor(name) {
this.name = name
if (executeSteppes.has(this.name)) {
throw new Error(`step name '${this.name}' already defined`)
}
executeSteppes.set(this.name, this)
}
public method(context) {
}
public static register(name, method) {
if (executeSteppes.get(name)) {
throw new Error(`step name '${name}' already defined`)
}
const step = {
name,
method
}
executeSteppes.set(name, step)
return step
}
public static get(name: string) {
if (executeSteppes.has(name)) {
return executeSteppes.get(name)
}
}
}