chartmind 1.0.3 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/build/src/engine/actions/process-action.js +5 -1
- package/build/src/engine/actions/process-action.js.map +1 -1
- package/build/src/interfaces/executable-async.interface.d.ts +16 -0
- package/build/src/interfaces/executable-async.interface.js +3 -0
- package/build/src/interfaces/executable-async.interface.js.map +1 -0
- package/build/src/interfaces/executable.interface.d.ts +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
@@ -68,7 +68,7 @@ Now, implement your classes and register them in the registry. Then you can star
|
|
68
68
|
import { ChartContext, Executable } from 'chartmind';
|
69
69
|
|
70
70
|
export class IncrementCounter implements Executable {
|
71
|
-
|
71
|
+
execute(chartContext: ChartContext): void {
|
72
72
|
const counter = chartContext.getVariable('counter') as number;
|
73
73
|
chartContext.setVariable('counter', counter + 1);
|
74
74
|
}
|
@@ -10,9 +10,13 @@ class ProcessAction extends base_action_1.BaseAction {
|
|
10
10
|
const Executable = executable_registry_1.ExecutableRegistry.instance.getExecutableByName(executableName);
|
11
11
|
if (Executable) {
|
12
12
|
const instance = new Executable();
|
13
|
-
|
13
|
+
const result = instance.execute(chartContext);
|
14
|
+
if (result instanceof Promise) {
|
15
|
+
await result;
|
16
|
+
}
|
14
17
|
}
|
15
18
|
// console.log(`SymbolProcess ${this.symbol.label} executed.`);
|
19
|
+
return;
|
16
20
|
}
|
17
21
|
getNext() {
|
18
22
|
const connection = this.chart.getConnectionBySourceId(this.symbol.id);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"process-action.js","sourceRoot":"","sources":["../../../../src/engine/actions/process-action.ts"],"names":[],"mappings":";;;AACA,+CAAyC;AAEzC,yEAAmE;AAGnE,MAAa,aAAc,SAAQ,wBAAU;IACpC,KAAK,CAAC,OAAO,CAAC,YAA0B;QAC7C,MAAM,aAAa,GAAG,IAAI,CAAC,MAAuB,CAAC;QACnD,MAAM,cAAc,GAAG,aAAa,CAAC,UAAU,CAAC;QAChD,MAAM,UAAU,GACd,wCAAkB,CAAC,QAAQ,CAAC,mBAAmB,CAAC,cAAc,CAAC,CAAC;QAElE,IAAI,UAAU,EAAE;YACd,MAAM,QAAQ,GAAG,IAAI,UAAU,EAAE,CAAC;
|
1
|
+
{"version":3,"file":"process-action.js","sourceRoot":"","sources":["../../../../src/engine/actions/process-action.ts"],"names":[],"mappings":";;;AACA,+CAAyC;AAEzC,yEAAmE;AAGnE,MAAa,aAAc,SAAQ,wBAAU;IACpC,KAAK,CAAC,OAAO,CAAC,YAA0B;QAC7C,MAAM,aAAa,GAAG,IAAI,CAAC,MAAuB,CAAC;QACnD,MAAM,cAAc,GAAG,aAAa,CAAC,UAAU,CAAC;QAChD,MAAM,UAAU,GACd,wCAAkB,CAAC,QAAQ,CAAC,mBAAmB,CAAC,cAAc,CAAC,CAAC;QAElE,IAAI,UAAU,EAAE;YACd,MAAM,QAAQ,GAAG,IAAI,UAAU,EAAE,CAAC;YAElC,MAAM,MAAM,GAAG,QAAQ,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;YAC9C,IAAI,MAAM,YAAY,OAAO,EAAE;gBAC7B,MAAM,MAAM,CAAC;aACd;SACF;QAED,+DAA+D;QAC/D,OAAO;IACT,CAAC;IAEM,OAAO;QACZ,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,uBAAuB,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QAEtE,IAAI,CAAC,UAAU,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,MAAM,EAAE;YAC5C,OAAO,SAAS,CAAC;SAClB;QAED,OAAO,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC5D,CAAC;CACF;AA7BD,sCA6BC"}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import { ChartContext } from '../engine/chart/context/chart-context';
|
2
|
+
/**
|
3
|
+
* Represents an async executable action that can be performed within a chart context.
|
4
|
+
*
|
5
|
+
* @interface ExecutableAsync
|
6
|
+
* @remarks
|
7
|
+
* Implement this interface to define custom actions that operate on a given {@link ChartContext}.
|
8
|
+
*
|
9
|
+
* @method execute
|
10
|
+
* Executes the action using the provided chart context.
|
11
|
+
* @param chartContext - The context in which the action should be executed.
|
12
|
+
* @returns A promise that resolves when the execution is complete.
|
13
|
+
*/
|
14
|
+
export interface ExecutableAsync {
|
15
|
+
execute(chartContext: ChartContext): Promise<void>;
|
16
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"executable-async.interface.js","sourceRoot":"","sources":["../../../src/interfaces/executable-async.interface.ts"],"names":[],"mappings":""}
|
@@ -9,8 +9,8 @@ import { ChartContext } from '../engine/chart/context/chart-context';
|
|
9
9
|
* @method execute
|
10
10
|
* Executes the action using the provided chart context.
|
11
11
|
* @param chartContext - The context in which the action should be executed.
|
12
|
-
* @returns
|
12
|
+
* @returns Returns nothing or a Promise that resolves when the action is complete.
|
13
13
|
*/
|
14
14
|
export interface Executable {
|
15
|
-
execute(chartContext: ChartContext): Promise<void>;
|
15
|
+
execute(chartContext: ChartContext): void | Promise<void>;
|
16
16
|
}
|