@awesome-ecs/abstract 0.6.0 → 0.7.0
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.
|
@@ -1,4 +1,13 @@
|
|
|
1
|
+
import { PerformanceTimeEntry } from "../utils/performance-timer";
|
|
1
2
|
import { IMiddleware } from "./middleware";
|
|
3
|
+
export declare enum PipelineStatus {
|
|
4
|
+
completed = 0,
|
|
5
|
+
halted = 1
|
|
6
|
+
}
|
|
7
|
+
export interface IPipelineResult {
|
|
8
|
+
readonly status: PipelineStatus;
|
|
9
|
+
readonly metrics: PerformanceTimeEntry[];
|
|
10
|
+
}
|
|
2
11
|
/**
|
|
3
12
|
* A middleware container and dispatcher.
|
|
4
13
|
*/
|
|
@@ -6,13 +15,13 @@ export interface IPipeline<TContext> {
|
|
|
6
15
|
/**
|
|
7
16
|
* Register middlewares for this pipeline, in order.
|
|
8
17
|
*/
|
|
9
|
-
use(...
|
|
18
|
+
use(...middleware: IMiddleware<TContext>[]): void;
|
|
10
19
|
/**
|
|
11
20
|
* Execute the chain of middlewares, in the order they were added on a given Context.
|
|
12
21
|
*/
|
|
13
|
-
dispatch(context: TContext):
|
|
22
|
+
dispatch(context: TContext): IPipelineResult | Promise<IPipelineResult>;
|
|
14
23
|
/**
|
|
15
24
|
* Runs the Cleanup function on all middlewares.
|
|
16
25
|
*/
|
|
17
|
-
cleanup(context: TContext):
|
|
26
|
+
cleanup(context: TContext): IPipelineResult | Promise<IPipelineResult>;
|
|
18
27
|
}
|
|
@@ -1,3 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PipelineStatus = void 0;
|
|
4
|
+
var PipelineStatus;
|
|
5
|
+
(function (PipelineStatus) {
|
|
6
|
+
PipelineStatus[PipelineStatus["completed"] = 0] = "completed";
|
|
7
|
+
PipelineStatus[PipelineStatus["halted"] = 1] = "halted";
|
|
8
|
+
})(PipelineStatus = exports.PipelineStatus || (exports.PipelineStatus = {}));
|
|
3
9
|
//# sourceMappingURL=pipeline.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipeline.js","sourceRoot":"","sources":["../../src/pipelines/pipeline.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"pipeline.js","sourceRoot":"","sources":["../../src/pipelines/pipeline.ts"],"names":[],"mappings":";;;AAGA,IAAY,cAGX;AAHD,WAAY,cAAc;IACxB,6DAAS,CAAA;IACT,uDAAM,CAAA;AACR,CAAC,EAHW,cAAc,GAAd,sBAAc,KAAd,sBAAc,QAGzB"}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { IEntity } from "../entities/entity";
|
|
2
2
|
import { IEntityUpdate } from "../entities/entity-queue";
|
|
3
|
+
import { PerformanceTimeEntry } from "../utils/performance-timer";
|
|
3
4
|
import { ISystemMiddleware } from "./system-middleware";
|
|
4
5
|
import { SystemPipelineType } from "./system-pipeline-type";
|
|
6
|
+
export interface ISystemsModuleRuntimeResult {
|
|
7
|
+
metrics: PerformanceTimeEntry[];
|
|
8
|
+
}
|
|
5
9
|
/**
|
|
6
10
|
* The SystemModule is the main way of registering and triggering the SystemMiddlewares registered for an Entity.
|
|
7
11
|
* It can handle EntityUpdate objects and decides which SystemPipelines to trigger based on the information in the EntityUpdate.
|
|
@@ -11,7 +15,7 @@ export interface ISystemsModule {
|
|
|
11
15
|
* The method allows triggering all registered SystemPipelines, to apply the changes from the provided EntityUpdate to an Entity instance.
|
|
12
16
|
* @param update The EntityUpdate containing the desired changes to be applied on an Entity instance.
|
|
13
17
|
*/
|
|
14
|
-
triggerSystems(update: IEntityUpdate):
|
|
18
|
+
triggerSystems(update: IEntityUpdate): ISystemsModuleRuntimeResult | Promise<ISystemsModuleRuntimeResult>;
|
|
15
19
|
/**
|
|
16
20
|
* @param type The SystemPipelineType to append the provided SystemMiddlewares to.
|
|
17
21
|
* @param systems The SystemMiddlewares will be registered in the provided SystemPipelineType in the same order as the provided array.
|
|
@@ -3,7 +3,7 @@ import { PerformanceTimeEntry } from "../utils/performance-timer";
|
|
|
3
3
|
import { ISystemsModule } from "./systems-module";
|
|
4
4
|
export interface ISystemsRuntimeTickResult {
|
|
5
5
|
readonly remainingUpdatesCount: number;
|
|
6
|
-
readonly metrics
|
|
6
|
+
readonly metrics: PerformanceTimeEntry[];
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
9
|
* The System Runtime allows running a loop of Ticks.
|
|
@@ -22,5 +22,5 @@ export interface ISystemsRuntime {
|
|
|
22
22
|
/**
|
|
23
23
|
* The method allows for an Unit of Work implementation, and returns the remaining quantity of items scheduled to be processed next.
|
|
24
24
|
*/
|
|
25
|
-
runTick(): ISystemsRuntimeTickResult
|
|
25
|
+
runTick(): ISystemsRuntimeTickResult | Promise<ISystemsRuntimeTickResult>;
|
|
26
26
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
export declare type PerformanceTimerUid = number;
|
|
2
2
|
export interface PerformanceTimeEntry {
|
|
3
|
+
name: string;
|
|
3
4
|
startedAt: number;
|
|
4
5
|
endedAt?: number;
|
|
5
6
|
msPassed?: number;
|
|
6
7
|
}
|
|
7
8
|
export interface IPerformanceTimer {
|
|
8
|
-
startTimer(name
|
|
9
|
+
startTimer(name: string): PerformanceTimerUid;
|
|
9
10
|
endTimer(timerUid: PerformanceTimerUid): PerformanceTimeEntry;
|
|
10
11
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@awesome-ecs/abstract",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "A comprehensive Entity-Component-System (ECS) Architecture implementation. Abstract components.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -32,5 +32,5 @@
|
|
|
32
32
|
"url": "https://github.com/andreicojocaru/awesome-ecs/issues"
|
|
33
33
|
},
|
|
34
34
|
"homepage": "https://github.com/andreicojocaru/awesome-ecs#readme",
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "437c4702120c2fa0857a034e21096f0e683845bc"
|
|
36
36
|
}
|