bard-legends-framework 0.10.8 → 0.11.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.
- package/dist/game-entities/base/attachable.d.ts +10 -3
- package/dist/game-entities/base/attachable.js +50 -18
- package/dist/game-entities/base/attachable.test.js +81 -95
- package/dist/game-entities/base/helpers/attachable.store.d.ts +2 -8
- package/dist/game-entities/base/helpers/attachable.store.js +46 -17
- package/dist/game-entities/base/helpers/attachable.store.test.d.ts +1 -0
- package/dist/game-entities/base/helpers/attachable.store.test.js +234 -0
- package/dist/game-entities/base/helpers/decorate-actions-lib.d.ts +3 -3
- package/dist/game-entities/base/helpers/decorate-actions-lib.js +5 -5
- package/dist/game-entities/base/helpers/referance-variable.d.ts +2 -2
- package/dist/game-entities/base/helpers/referance-variable.js +2 -2
- package/dist/game-entities/controller/controller.d.ts +0 -1
- package/dist/game-entities/controller/controller.js +1 -0
- package/dist/game-entities/controller/controller.test.js +2 -2
- package/dist/game-entities/entity/entity.d.ts +10 -9
- package/dist/game-entities/entity/entity.js +9 -13
- package/dist/game-entities/entity/entity.test.js +47 -139
- package/dist/game-entities/entity/helpers/entity-store.helper.d.ts +6 -9
- package/dist/game-entities/entity/helpers/entity-store.helper.js +22 -57
- package/dist/game-entities/entity/helpers/entity-store.helper.test.d.ts +1 -0
- package/dist/game-entities/entity/helpers/entity-store.helper.test.js +136 -0
- package/dist/game-entities/entity/helpers/entity-views.helper.d.ts +1 -1
- package/dist/game-entities/entity/helpers/entity-views.helper.js +5 -3
- package/dist/game-entities/entity/singleton-entity.d.ts +3 -3
- package/dist/game-entities/entity/singleton-entity.js +1 -1
- package/dist/game-entities/entity/singleton-entity.test.js +2 -29
- package/dist/game-entities/index.d.ts +1 -5
- package/dist/game-entities/index.js +3 -24
- package/dist/game-entities/scene/scene.d.ts +4 -4
- package/dist/game-entities/scene/scene.js +31 -25
- package/dist/game-entities/scene/scene.test.js +14 -36
- package/dist/game-entities/service/service.js +5 -3
- package/dist/game-entities/service/service.test.js +2 -28
- package/dist/game-entities/unit-test.helper.d.ts +5 -0
- package/dist/game-entities/unit-test.helper.js +14 -0
- package/dist/game-entities/update-cycle.d.ts +15 -4
- package/dist/game-entities/update-cycle.js +14 -9
- package/dist/game-entities/view/view.d.ts +7 -8
- package/dist/game-entities/view/view.js +12 -21
- package/dist/game-entities/view/view.test.js +54 -244
- package/dist/physics/entity-types/immovable-physics-entity.d.ts +1 -3
- package/dist/physics/entity-types/immovable-physics-entity.js +1 -3
- package/dist/physics/entity-types/movable-entity.js +4 -4
- package/dist/physics/entity-types/movable-physics-entity.d.ts +2 -3
- package/dist/physics/entity-types/movable-physics-entity.js +5 -6
- package/dist/physics/entity-types/physics-entity.d.ts +3 -2
- package/dist/physics/entity-types/physics-entity.js +10 -7
- package/dist/physics/interfaces.d.ts +1 -1
- package/dist/physics/module//342/232/234/357/270/217gateways/controllers/physics-internal.controller.d.ts +3 -3
- package/dist/physics/module//342/232/234/357/270/217gateways/controllers/physics.controller.d.ts +1 -1
- package/dist/physics/module//342/232/234/357/270/217gateways/physics-internal.gateway.d.ts +3 -3
- package/dist/physics/module//342/232/234/357/270/217gateways/physics.gateway.d.ts +1 -1
- package/dist/physics/module//360/237/223/220services/creation/physics-world.service.js +2 -2
- package/dist/physics/module//360/237/223/220services/path-finding/availability-grid.service.js +1 -1
- package/dist/physics/module//360/237/223/220services/path-finding/path-finder.service.js +1 -1
- package/dist/physics/module//360/237/223/220services/query/physics-query.service.d.ts +3 -3
- package/dist/physics/module//360/237/223/220services/test-visuals/test-visuals.service.js +17 -7
- package/dist/physics/module//360/237/247/212entities/physics-world.entity.js +2 -2
- package/dist/pixi/components/helpers/smooth-scroller.d.ts +1 -2
- package/dist/pixi/components/helpers/smooth-scroller.js +1 -3
- package/dist/pixi/components/helpers/smooth-scroller.test.js +5 -5
- package/dist/pixi/components/mouse-wheel-listener.ui.d.ts +3 -2
- package/dist/pixi/components/mouse-wheel-listener.ui.js +10 -7
- package/dist/pixi/components/scroll-area.ui.d.ts +0 -1
- package/dist/pixi/components/scroll-area.ui.js +1 -4
- package/dist/pixi/display-object/container-attributes.d.ts +3 -4
- package/dist/pixi/display-object/container-attributes.js +2 -3
- package/dist/pixi/display-object/container.d.ts +0 -4
- package/dist/pixi/display-object/container.js +5 -17
- package/dist/pixi/display-object/objects/graphics/graphics.d.ts +1 -1
- package/dist/pixi/display-object/objects/graphics/graphics.js +5 -3
- package/dist/pixi/display-object/objects/placeholder.d.ts +1 -1
- package/dist/pixi/display-object/objects/placeholder.js +5 -3
- package/dist/pixi/display-object/objects/sprite/glow-sprite-generator.js +5 -3
- package/dist/pixi/display-object/objects/sprite/sprite.d.ts +1 -1
- package/dist/pixi/display-object/objects/sprite/sprite.js +12 -10
- package/dist/pixi/display-object/objects/text/text.d.ts +1 -1
- package/dist/pixi/display-object/objects/text/text.js +5 -3
- package/dist/pixi/game.d.ts +6 -2
- package/dist/pixi/game.js +14 -5
- package/dist/pixi/modules/CAMERA//360/237/247/212entities/camera.entity.js +4 -4
- package/dist/pixi/modules/CAMERA//360/237/247/251views/camera.view.d.ts +1 -1
- package/dist/pixi/modules/CAMERA//360/237/247/251views/camera.view.js +6 -4
- package/dist/pixi/services/keyboard/keyboard.d.ts +4 -2
- package/dist/pixi/services/keyboard/keyboard.js +6 -4
- package/dist/pixi/services/mouse/mouse-target-focus.service.d.ts +2 -1
- package/dist/pixi/services/mouse/mouse-target-focus.service.js +6 -5
- package/dist/pixi/services/mouse/mouse.service.d.ts +15 -5
- package/dist/pixi/services/mouse/mouse.service.js +38 -18
- package/dist/utilities/animator/animating-content/fade-in-content.d.ts +18 -0
- package/dist/utilities/animator/animating-content/fade-in-content.js +37 -0
- package/dist/utilities/animator/animating-content/slide-in-content.d.ts +37 -0
- package/dist/utilities/animator/animating-content/slide-in-content.js +99 -0
- package/dist/utilities/animator/animations.d.ts +37 -0
- package/dist/utilities/animator/animations.js +88 -0
- package/dist/utilities/animator/animator.d.ts +61 -0
- package/dist/utilities/animator/animator.js +315 -0
- package/dist/utilities/animator/animator.test.d.ts +1 -0
- package/dist/utilities/animator/animator.test.js +867 -0
- package/dist/utilities/animator/index.d.ts +7 -0
- package/dist/utilities/animator/index.js +24 -0
- package/dist/utilities/animator/state-animation/slide-state-animation.d.ts +24 -0
- package/dist/utilities/animator/state-animation/slide-state-animation.js +130 -0
- package/dist/utilities/animator/state-animation/slide-state-animation.test.d.ts +1 -0
- package/dist/utilities/animator/state-animation/slide-state-animation.test.js +301 -0
- package/dist/utilities/animator/state-animation/state-animation.d.ts +33 -0
- package/dist/utilities/animator/state-animation/state-animation.js +146 -0
- package/dist/utilities/animator/state-animation/state-animation.test.d.ts +1 -0
- package/dist/utilities/animator/state-animation/state-animation.test.js +335 -0
- package/dist/utilities/animator/state-animation/visit-disappear-state-animation.d.ts +32 -0
- package/dist/utilities/animator/state-animation/visit-disappear-state-animation.js +168 -0
- package/dist/utilities/animator/state-animation/visit-disappear-state-animation.test.d.ts +1 -0
- package/dist/utilities/animator/state-animation/visit-disappear-state-animation.test.js +431 -0
- package/dist/utilities/data-structures/vector-set/vector-set.d.ts +7 -0
- package/dist/utilities/data-structures/vector-set/vector-set.js +26 -0
- package/dist/utilities/delta-time/delta-time.d.ts +3 -0
- package/dist/utilities/delta-time/delta-time.js +10 -0
- package/dist/utilities/grid-algorithms/closest-available-space/closest-available-space.helper.d.ts +6 -0
- package/dist/utilities/grid-algorithms/closest-available-space/closest-available-space.helper.js +55 -0
- package/dist/utilities/grid-algorithms/closest-available-space/closest-available-space.helper.test.d.ts +1 -0
- package/dist/utilities/grid-algorithms/closest-available-space/closest-available-space.helper.test.js +100 -0
- package/dist/utilities/grid-algorithms/path-finder/path-finder.d.ts +8 -0
- package/dist/utilities/grid-algorithms/path-finder/path-finder.js +98 -0
- package/dist/utilities/grid-algorithms/path-finder/path-finder.test.d.ts +1 -0
- package/dist/utilities/grid-algorithms/path-finder/path-finder.test.js +155 -0
- package/dist/utilities/grid-algorithms/position-to-grid-position-converter.d.ts +6 -0
- package/dist/utilities/grid-algorithms/position-to-grid-position-converter.js +17 -0
- package/dist/utilities/grid-algorithms/vector-field-path-finder/vector-field-path-finder.d.ts +18 -0
- package/dist/utilities/grid-algorithms/vector-field-path-finder/vector-field-path-finder.js +129 -0
- package/dist/utilities/grid-algorithms/vector-field-path-finder/vector-field-path-finder.test.d.ts +1 -0
- package/dist/utilities/grid-algorithms/vector-field-path-finder/vector-field-path-finder.test.js +254 -0
- package/dist/utilities/index.d.ts +6 -6
- package/dist/utilities/index.js +6 -6
- package/dist/utilities/libraries/animator/animator.d.ts +3 -5
- package/dist/utilities/libraries/animator/animator.js +17 -19
- package/dist/utilities/libraries/animator/state-animation/slide-state-animation.d.ts +2 -2
- package/dist/utilities/libraries/animator/state-animation/slide-state-animation.js +1 -1
- package/dist/utilities/libraries/animator/state-animation/state-animation.d.ts +2 -2
- package/dist/utilities/libraries/animator/state-animation/state-animation.js +1 -1
- package/dist/utilities/libraries/animator/state-animation/visit-disappear-state-animation.d.ts +2 -2
- package/dist/utilities/libraries/animator/state-animation/visit-disappear-state-animation.js +1 -1
- package/package.json +6 -6
|
@@ -1,49 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
2
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
19
3
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
20
4
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
21
5
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
22
6
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
23
7
|
};
|
|
24
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
25
|
-
if (mod && mod.__esModule) return mod;
|
|
26
|
-
var result = {};
|
|
27
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
28
|
-
__setModuleDefault(result, mod);
|
|
29
|
-
return result;
|
|
30
|
-
};
|
|
31
8
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
32
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
33
10
|
};
|
|
34
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
-
const ActionsLib = __importStar(require("actions-lib"));
|
|
36
|
-
const helpers_lib_1 = require("helpers-lib");
|
|
37
12
|
const vitest_1 = require("vitest");
|
|
38
|
-
const decorate_actions_lib_1 = require("../base/helpers/decorate-actions-lib");
|
|
39
13
|
const scene_1 = require("../scene/scene");
|
|
14
|
+
const unit_test_helper_1 = require("../unit-test.helper");
|
|
40
15
|
const update_cycle_1 = require("../update-cycle");
|
|
41
16
|
const view_1 = require("../view/view");
|
|
42
17
|
const entity_1 = require("./entity");
|
|
43
|
-
decorate_actions_lib_1.ActionsLibDecorator.decorate(ActionsLib);
|
|
44
18
|
(0, vitest_1.describe)('ENTITY', () => {
|
|
45
19
|
(0, vitest_1.beforeEach)(() => {
|
|
46
|
-
|
|
20
|
+
unit_test_helper_1.UnitTestHelper.hardReset();
|
|
47
21
|
let SampleScene = class SampleScene extends scene_1.Scene {
|
|
48
22
|
async init() { }
|
|
49
23
|
update() { }
|
|
@@ -54,92 +28,6 @@ decorate_actions_lib_1.ActionsLibDecorator.decorate(ActionsLib);
|
|
|
54
28
|
], SampleScene);
|
|
55
29
|
SampleScene.open();
|
|
56
30
|
});
|
|
57
|
-
(0, vitest_1.test)('entities should have ids', () => {
|
|
58
|
-
let Sample = class Sample extends entity_1.Entity {
|
|
59
|
-
};
|
|
60
|
-
Sample = __decorate([
|
|
61
|
-
(0, entity_1.EntityDecorator)()
|
|
62
|
-
], Sample);
|
|
63
|
-
let sample = new Sample().attach(scene_1.Scene.getActiveSceneOrFail());
|
|
64
|
-
(0, vitest_1.expect)(sample.id).toBeDefined();
|
|
65
|
-
});
|
|
66
|
-
(0, vitest_1.test)('entities ids should be unique', () => {
|
|
67
|
-
let BaseEntity = class BaseEntity extends entity_1.Entity {
|
|
68
|
-
};
|
|
69
|
-
BaseEntity = __decorate([
|
|
70
|
-
(0, entity_1.EntityDecorator)()
|
|
71
|
-
], BaseEntity);
|
|
72
|
-
let baseEntity = new BaseEntity().attach(scene_1.Scene.getActiveSceneOrFail());
|
|
73
|
-
let Sample = class Sample extends entity_1.Entity {
|
|
74
|
-
};
|
|
75
|
-
Sample = __decorate([
|
|
76
|
-
(0, entity_1.EntityDecorator)()
|
|
77
|
-
], Sample);
|
|
78
|
-
let sample1 = new Sample().attach(baseEntity);
|
|
79
|
-
let sample2 = new Sample().attach(baseEntity);
|
|
80
|
-
(0, vitest_1.expect)(sample1.id !== sample2.id).toBeTruthy();
|
|
81
|
-
});
|
|
82
|
-
(0, vitest_1.test)('class names should be unique', () => {
|
|
83
|
-
(0, vitest_1.expect)(() => {
|
|
84
|
-
{
|
|
85
|
-
let _Sample = class _Sample extends entity_1.Entity {
|
|
86
|
-
};
|
|
87
|
-
_Sample = __decorate([
|
|
88
|
-
(0, entity_1.EntityDecorator)()
|
|
89
|
-
], _Sample);
|
|
90
|
-
}
|
|
91
|
-
{
|
|
92
|
-
let _Sample = class _Sample extends entity_1.Entity {
|
|
93
|
-
};
|
|
94
|
-
_Sample = __decorate([
|
|
95
|
-
(0, entity_1.EntityDecorator)()
|
|
96
|
-
], _Sample);
|
|
97
|
-
}
|
|
98
|
-
}).toThrow();
|
|
99
|
-
});
|
|
100
|
-
(0, vitest_1.test)('attach', async () => {
|
|
101
|
-
var Child_1;
|
|
102
|
-
let Parent = class Parent extends entity_1.Entity {
|
|
103
|
-
};
|
|
104
|
-
Parent = __decorate([
|
|
105
|
-
(0, entity_1.EntityDecorator)()
|
|
106
|
-
], Parent);
|
|
107
|
-
let Child = class Child extends entity_1.Entity {
|
|
108
|
-
static { Child_1 = this; }
|
|
109
|
-
static { this.destroyCalled = false; }
|
|
110
|
-
afterDestroy() {
|
|
111
|
-
Child_1.destroyCalled = true;
|
|
112
|
-
}
|
|
113
|
-
};
|
|
114
|
-
Child = Child_1 = __decorate([
|
|
115
|
-
(0, entity_1.EntityDecorator)()
|
|
116
|
-
], Child);
|
|
117
|
-
let parent = new Parent().attach(scene_1.Scene.getActiveSceneOrFail());
|
|
118
|
-
new Child().attach(parent);
|
|
119
|
-
parent.destroy();
|
|
120
|
-
await update_cycle_1.UpdateCycle.triggerUpdateTick(1); // Update cycle should take place to destroy functions to be called
|
|
121
|
-
(0, vitest_1.expect)(Child.destroyCalled).toBeTruthy();
|
|
122
|
-
});
|
|
123
|
-
(0, vitest_1.test)(`attach to self should throw error`, () => {
|
|
124
|
-
let Sample = class Sample extends entity_1.Entity {
|
|
125
|
-
};
|
|
126
|
-
Sample = __decorate([
|
|
127
|
-
(0, entity_1.EntityDecorator)()
|
|
128
|
-
], Sample);
|
|
129
|
-
let sample = new Sample();
|
|
130
|
-
(0, vitest_1.expect)(() => {
|
|
131
|
-
sample.attach(sample);
|
|
132
|
-
}).toThrow(`Entity cannot be attach to itself!`);
|
|
133
|
-
});
|
|
134
|
-
(0, vitest_1.test)('decorator should not effect static variables', () => {
|
|
135
|
-
let Sample = class Sample extends entity_1.Entity {
|
|
136
|
-
static { this.test = 'test'; }
|
|
137
|
-
};
|
|
138
|
-
Sample = __decorate([
|
|
139
|
-
(0, entity_1.EntityDecorator)()
|
|
140
|
-
], Sample);
|
|
141
|
-
(0, vitest_1.expect)(Sample.test).toEqual('test');
|
|
142
|
-
});
|
|
143
31
|
(0, vitest_1.test)('get entity by id basic sample', () => {
|
|
144
32
|
let Sample = class Sample extends entity_1.Entity {
|
|
145
33
|
};
|
|
@@ -151,17 +39,28 @@ decorate_actions_lib_1.ActionsLibDecorator.decorate(ActionsLib);
|
|
|
151
39
|
});
|
|
152
40
|
(0, vitest_1.test)('get entity by id or fail should return error', () => {
|
|
153
41
|
let Sample1 = class Sample1 extends entity_1.Entity {
|
|
42
|
+
constructor(foo) {
|
|
43
|
+
super();
|
|
44
|
+
this.foo = foo;
|
|
45
|
+
}
|
|
154
46
|
};
|
|
155
47
|
Sample1 = __decorate([
|
|
156
|
-
(0, entity_1.EntityDecorator)()
|
|
48
|
+
(0, entity_1.EntityDecorator)(),
|
|
49
|
+
__metadata("design:paramtypes", [String])
|
|
157
50
|
], Sample1);
|
|
158
51
|
let Sample2 = class Sample2 extends entity_1.Entity {
|
|
52
|
+
constructor(foo) {
|
|
53
|
+
super();
|
|
54
|
+
this.foo = foo;
|
|
55
|
+
}
|
|
159
56
|
};
|
|
160
57
|
Sample2 = __decorate([
|
|
161
|
-
(0, entity_1.EntityDecorator)()
|
|
58
|
+
(0, entity_1.EntityDecorator)(),
|
|
59
|
+
__metadata("design:paramtypes", [String])
|
|
162
60
|
], Sample2);
|
|
163
|
-
|
|
164
|
-
new
|
|
61
|
+
// Foo is added to see that there should not be type complaining about the constructor parameters
|
|
62
|
+
let sample1 = new Sample1('foo').attach(scene_1.Scene.getActiveSceneOrFail());
|
|
63
|
+
new Sample2('foo').attach(sample1);
|
|
165
64
|
(0, vitest_1.expect)(() => Sample2.getInstanceByIdOrFail(sample1.id)).toThrow();
|
|
166
65
|
(0, vitest_1.expect)(() => Sample2.getInstanceByIdOrFail('notValidId')).toThrow();
|
|
167
66
|
});
|
|
@@ -174,7 +73,6 @@ decorate_actions_lib_1.ActionsLibDecorator.decorate(ActionsLib);
|
|
|
174
73
|
let sample = new Sample().attach(scene_1.Scene.getActiveSceneOrFail());
|
|
175
74
|
(0, vitest_1.expect)(Sample.getInstanceById(sample.id)).toBeDefined();
|
|
176
75
|
sample.destroy();
|
|
177
|
-
await update_cycle_1.UpdateCycle.triggerUpdateTick(1); // Update cycle should take place to destroy functions to be called
|
|
178
76
|
(0, vitest_1.expect)(Sample.getInstanceById(sample.id)).toBeUndefined();
|
|
179
77
|
});
|
|
180
78
|
(0, vitest_1.test)('select entities', () => {
|
|
@@ -193,21 +91,35 @@ decorate_actions_lib_1.ActionsLibDecorator.decorate(ActionsLib);
|
|
|
193
91
|
let sample2 = new Sample().attach(baseEntity);
|
|
194
92
|
(0, vitest_1.expect)(Sample.getEntities()).toEqual([sample1, sample2]);
|
|
195
93
|
});
|
|
94
|
+
(0, vitest_1.test)('decorator should not complain aboutentity with constructor parameters', () => {
|
|
95
|
+
let _Sample = class _Sample extends entity_1.Entity {
|
|
96
|
+
constructor(test) {
|
|
97
|
+
super();
|
|
98
|
+
this.test = test;
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
_Sample = __decorate([
|
|
102
|
+
(0, entity_1.EntityDecorator)(),
|
|
103
|
+
__metadata("design:paramtypes", [String])
|
|
104
|
+
], _Sample);
|
|
105
|
+
});
|
|
196
106
|
(0, vitest_1.test)('lifecycle events', async () => {
|
|
197
|
-
scene_1.Scene.
|
|
107
|
+
scene_1.Scene['_activeScene'].set(undefined);
|
|
198
108
|
let callStack = [];
|
|
199
109
|
let SampleScene = class SampleScene extends scene_1.Scene {
|
|
200
110
|
constructor() {
|
|
201
111
|
super();
|
|
202
112
|
callStack.push('scene constructor');
|
|
113
|
+
this.onDestroy(() => {
|
|
114
|
+
callStack.push('scene destroy');
|
|
115
|
+
}).attach(this);
|
|
203
116
|
}
|
|
204
117
|
async init() { }
|
|
205
118
|
update() {
|
|
206
119
|
callStack.push('scene update');
|
|
207
120
|
}
|
|
208
|
-
async prepareToClose() {
|
|
209
|
-
|
|
210
|
-
callStack.push('scene destroy');
|
|
121
|
+
async prepareToClose() {
|
|
122
|
+
callStack.push('scene prepare to close');
|
|
211
123
|
}
|
|
212
124
|
};
|
|
213
125
|
SampleScene = __decorate([
|
|
@@ -226,13 +138,13 @@ decorate_actions_lib_1.ActionsLibDecorator.decorate(ActionsLib);
|
|
|
226
138
|
constructor() {
|
|
227
139
|
super();
|
|
228
140
|
callStack.push('entity constructor');
|
|
141
|
+
this.onDestroy(() => {
|
|
142
|
+
callStack.push('entity destroy');
|
|
143
|
+
}).attach(this);
|
|
229
144
|
}
|
|
230
145
|
update() {
|
|
231
146
|
callStack.push('entity update');
|
|
232
147
|
}
|
|
233
|
-
afterDestroy() {
|
|
234
|
-
callStack.push('entity destroy');
|
|
235
|
-
}
|
|
236
148
|
};
|
|
237
149
|
Sample = __decorate([
|
|
238
150
|
(0, entity_1.EntityDecorator)(),
|
|
@@ -242,29 +154,24 @@ decorate_actions_lib_1.ActionsLibDecorator.decorate(ActionsLib);
|
|
|
242
154
|
constructor(entity) {
|
|
243
155
|
super();
|
|
244
156
|
callStack.push('view constructor');
|
|
157
|
+
this.onDestroy(() => {
|
|
158
|
+
callStack.push('view destroy');
|
|
159
|
+
}).attach(this);
|
|
245
160
|
}
|
|
246
161
|
update() {
|
|
247
162
|
callStack.push('view update');
|
|
248
163
|
}
|
|
249
|
-
afterDestroy() {
|
|
250
|
-
callStack.push('view destroy');
|
|
251
|
-
}
|
|
252
164
|
};
|
|
253
165
|
_SampleView = __decorate([
|
|
254
166
|
(0, view_1.ViewDecorator)({ entity: Sample }),
|
|
255
167
|
__metadata("design:paramtypes", [Sample])
|
|
256
168
|
], _SampleView);
|
|
257
|
-
SampleScene.open();
|
|
258
|
-
await
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
await (
|
|
262
|
-
await update_cycle_1.UpdateCycle.triggerUpdateTick(1);
|
|
263
|
-
SampleScene.getInstanceOrFail().close();
|
|
264
|
-
await (0, helpers_lib_1.Wait)(); // Wait for the async scene close to be done
|
|
169
|
+
await SampleScene.open().onOpen;
|
|
170
|
+
await update_cycle_1.UpdateCycle.triggerUpdateTick(1); // make scene update to be triggered before any entity or view being created
|
|
171
|
+
new Sample().attach(SampleScene.getInstanceOrFail());
|
|
172
|
+
await update_cycle_1.UpdateCycle.triggerUpdateTick(1); // make update calls of scene entity and view to be triggered
|
|
173
|
+
await SampleScene.getInstanceOrFail().close();
|
|
265
174
|
OtherScene.open();
|
|
266
|
-
await (0, helpers_lib_1.Wait)(); // Wait for the async scene open to be done
|
|
267
|
-
await update_cycle_1.UpdateCycle.triggerUpdateTick(1); // Update cycle should take place to destroy functions to be called
|
|
268
175
|
(0, vitest_1.expect)(callStack).toEqual([
|
|
269
176
|
'scene constructor',
|
|
270
177
|
'scene update',
|
|
@@ -273,6 +180,7 @@ decorate_actions_lib_1.ActionsLibDecorator.decorate(ActionsLib);
|
|
|
273
180
|
'scene update',
|
|
274
181
|
'entity update',
|
|
275
182
|
'view update',
|
|
183
|
+
'scene prepare to close',
|
|
276
184
|
'view destroy',
|
|
277
185
|
'entity destroy',
|
|
278
186
|
'scene destroy'
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import { Entity, EntityClassType } from '../entity';
|
|
2
2
|
export declare class EntityStoreHelper {
|
|
3
|
-
private static
|
|
3
|
+
private static classIdToEntityIdToEntity;
|
|
4
4
|
static registerEntityClass(entityClass: EntityClassType): void;
|
|
5
5
|
static registerEntity(entity: Entity): void;
|
|
6
|
-
static unregisterEntity(
|
|
7
|
-
static
|
|
8
|
-
static getSingleton<T extends Entity>(EntityClass:
|
|
9
|
-
static getSingletonOrFail<T extends Entity>(EntityClass:
|
|
10
|
-
static getEntities<T extends Entity>(EntityClass:
|
|
11
|
-
static getEntityById<T extends Entity>(entityId: string, EntityClass: new (...args: any[]) => T): T | undefined;
|
|
12
|
-
private static getEntityByParsingId;
|
|
13
|
-
private static getClassNameFromEntityId;
|
|
6
|
+
static unregisterEntity(Class: EntityClassType, entityId: string): void;
|
|
7
|
+
static getEntity<T extends Entity>(Class: EntityClassType<T>, entityId: string): T | undefined;
|
|
8
|
+
static getSingleton<T extends Entity>(EntityClass: EntityClassType<T>): T | undefined;
|
|
9
|
+
static getSingletonOrFail<T extends Entity>(EntityClass: EntityClassType<T>): T;
|
|
10
|
+
static getEntities<T extends Entity>(EntityClass: EntityClassType<T>): T[];
|
|
14
11
|
}
|
|
@@ -1,81 +1,46 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.EntityStoreHelper = void 0;
|
|
4
|
-
const
|
|
4
|
+
const unit_test_helper_1 = require("../../unit-test.helper");
|
|
5
5
|
class EntityStoreHelper {
|
|
6
|
-
static { this.
|
|
6
|
+
static { this.classIdToEntityIdToEntity = new Map(); }
|
|
7
7
|
static registerEntityClass(entityClass) {
|
|
8
|
-
|
|
9
|
-
throw new Error(`EntityStoreHelper: Entity class names should be unique! This entity name is already taken. name: "${entityClass.name}"`);
|
|
10
|
-
}
|
|
11
|
-
else {
|
|
12
|
-
this.entities.set(entityClass.name, new Map());
|
|
13
|
-
}
|
|
8
|
+
this.classIdToEntityIdToEntity.set(entityClass.id, new Map());
|
|
14
9
|
}
|
|
15
10
|
static registerEntity(entity) {
|
|
16
|
-
let idToEntityMap = this.
|
|
11
|
+
let idToEntityMap = this.classIdToEntityIdToEntity.get(entity.classId);
|
|
17
12
|
idToEntityMap.set(entity.id, entity);
|
|
18
13
|
}
|
|
19
|
-
static unregisterEntity(
|
|
20
|
-
|
|
14
|
+
static unregisterEntity(Class, entityId) {
|
|
15
|
+
let classId = Class.id;
|
|
16
|
+
this.classIdToEntityIdToEntity.get(classId)?.delete(entityId);
|
|
21
17
|
}
|
|
22
|
-
static
|
|
23
|
-
return this.
|
|
18
|
+
static getEntity(Class, entityId) {
|
|
19
|
+
return this.classIdToEntityIdToEntity.get(Class.id)?.get(entityId);
|
|
24
20
|
}
|
|
25
21
|
static getSingleton(EntityClass) {
|
|
26
|
-
let entities = EntityStoreHelper.getEntities(EntityClass);
|
|
27
|
-
return entities[0];
|
|
28
|
-
}
|
|
29
|
-
static getSingletonOrFail(EntityClass) {
|
|
30
22
|
let entities = EntityStoreHelper.getEntities(EntityClass);
|
|
31
23
|
if (entities.length > 1) {
|
|
32
24
|
throw new Error(`EntityStoreHelper: selectSingleton is called with an entity that has multiple instances! Name: "${this.name}"`);
|
|
33
25
|
}
|
|
34
|
-
|
|
26
|
+
return entities[0];
|
|
27
|
+
}
|
|
28
|
+
static getSingletonOrFail(EntityClass) {
|
|
29
|
+
let entity = this.getSingleton(EntityClass);
|
|
30
|
+
if (!entity) {
|
|
35
31
|
throw new Error(`EntityStoreHelper: selectSingleton is called with an entity that has no instance! Name: "${this.name}"`);
|
|
36
32
|
}
|
|
37
|
-
|
|
38
|
-
return entities[0];
|
|
39
|
-
}
|
|
33
|
+
return entity;
|
|
40
34
|
}
|
|
41
35
|
static getEntities(EntityClass) {
|
|
42
|
-
let idToEntityMap = this.
|
|
43
|
-
|
|
44
|
-
return entities.filter(entity => !entity['destroyed']);
|
|
45
|
-
}
|
|
46
|
-
static getEntityById(entityId, EntityClass) {
|
|
47
|
-
let entity = this.getEntityByParsingId(entityId);
|
|
48
|
-
if (entity) {
|
|
49
|
-
if (entity instanceof EntityClass) {
|
|
50
|
-
return entity;
|
|
51
|
-
}
|
|
52
|
-
else {
|
|
53
|
-
throw new Error(`EntityStoreHelper: The given id: "${entityId}", is not belonging to the class: "${EntityClass.name}"`);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
static getEntityByParsingId(entityId) {
|
|
58
|
-
try {
|
|
59
|
-
let className = this.getClassNameFromEntityId(entityId);
|
|
60
|
-
return this.entities.get(className)?.get(entityId);
|
|
61
|
-
}
|
|
62
|
-
catch {
|
|
63
|
-
throw new Error(`EntityStoreHelper.getEntityByIdWithoutType(): invalid entity id: "${entityId}"`);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
static getClassNameFromEntityId(entityId) {
|
|
67
|
-
if (!entityId) {
|
|
68
|
-
throw new Error(`EntityStoreHelper: getClassNameFromEntityId called with no id: "${entityId}"`);
|
|
69
|
-
}
|
|
70
|
-
let index = entityId.indexOf(':');
|
|
71
|
-
if (index === -1) {
|
|
72
|
-
throw new Error(`EntityStoreHelper: invalid entity id: "${entityId}"`);
|
|
73
|
-
}
|
|
74
|
-
return entityId.substring(0, index);
|
|
36
|
+
let idToEntityMap = this.classIdToEntityIdToEntity.get(EntityClass.id);
|
|
37
|
+
return Array.from(idToEntityMap.values());
|
|
75
38
|
}
|
|
76
39
|
}
|
|
77
40
|
exports.EntityStoreHelper = EntityStoreHelper;
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
41
|
+
unit_test_helper_1.UnitTestHelper.onHardReset
|
|
42
|
+
.subscribe(() => {
|
|
43
|
+
EntityStoreHelper['classIdToEntityIdToEntity'].clear();
|
|
44
|
+
})
|
|
45
|
+
.attachToRoot();
|
|
81
46
|
//# sourceMappingURL=entity-store.helper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
const vitest_1 = require("vitest");
|
|
10
|
+
const unit_test_helper_1 = require("../../unit-test.helper");
|
|
11
|
+
const entity_1 = require("../entity");
|
|
12
|
+
const singleton_entity_1 = require("../singleton-entity");
|
|
13
|
+
const entity_store_helper_1 = require("./entity-store.helper");
|
|
14
|
+
(0, vitest_1.describe)('EntityStoreHelper', () => {
|
|
15
|
+
(0, vitest_1.beforeEach)(() => {
|
|
16
|
+
unit_test_helper_1.UnitTestHelper.hardReset();
|
|
17
|
+
});
|
|
18
|
+
(0, vitest_1.describe)('registering entity class', () => {
|
|
19
|
+
(0, vitest_1.test)('should register entity class', () => {
|
|
20
|
+
let Sample = class Sample extends entity_1.Entity {
|
|
21
|
+
};
|
|
22
|
+
Sample = __decorate([
|
|
23
|
+
(0, entity_1.EntityDecorator)()
|
|
24
|
+
], Sample);
|
|
25
|
+
entity_store_helper_1.EntityStoreHelper.registerEntityClass(Sample);
|
|
26
|
+
let classId = Sample.id;
|
|
27
|
+
(0, vitest_1.expect)(classId).toBeDefined();
|
|
28
|
+
if (classId) {
|
|
29
|
+
(0, vitest_1.expect)(entity_store_helper_1.EntityStoreHelper['classIdToEntityIdToEntity'].get(classId)).toBeDefined();
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
(0, vitest_1.test)('should register entity class with different class ids', () => {
|
|
33
|
+
let Sample1 = class Sample1 extends entity_1.Entity {
|
|
34
|
+
};
|
|
35
|
+
Sample1 = __decorate([
|
|
36
|
+
(0, entity_1.EntityDecorator)()
|
|
37
|
+
], Sample1);
|
|
38
|
+
let Sample2 = class Sample2 extends entity_1.Entity {
|
|
39
|
+
};
|
|
40
|
+
Sample2 = __decorate([
|
|
41
|
+
(0, entity_1.EntityDecorator)()
|
|
42
|
+
], Sample2);
|
|
43
|
+
entity_store_helper_1.EntityStoreHelper.registerEntityClass(Sample1);
|
|
44
|
+
entity_store_helper_1.EntityStoreHelper.registerEntityClass(Sample2);
|
|
45
|
+
let classId1 = entity_store_helper_1.EntityStoreHelper['classIdToEntityIdToEntity'].get(Sample1.id);
|
|
46
|
+
let classId2 = entity_store_helper_1.EntityStoreHelper['classIdToEntityIdToEntity'].get(Sample2.id);
|
|
47
|
+
(0, vitest_1.expect)(classId1).toBeDefined();
|
|
48
|
+
(0, vitest_1.expect)(classId2).toBeDefined();
|
|
49
|
+
(0, vitest_1.expect)(classId1).not.toBe(classId2);
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
(0, vitest_1.describe)('crud operations on entity', () => {
|
|
53
|
+
(0, vitest_1.test)('register entity', () => {
|
|
54
|
+
let Sample = class Sample extends entity_1.Entity {
|
|
55
|
+
};
|
|
56
|
+
Sample = __decorate([
|
|
57
|
+
(0, entity_1.EntityDecorator)()
|
|
58
|
+
], Sample);
|
|
59
|
+
let entity = new Sample().attachToRoot();
|
|
60
|
+
entity_store_helper_1.EntityStoreHelper.registerEntity(entity);
|
|
61
|
+
(0, vitest_1.expect)(entity_store_helper_1.EntityStoreHelper.getEntity(Sample, entity.id)).toBeDefined();
|
|
62
|
+
});
|
|
63
|
+
(0, vitest_1.test)('unregister entity', () => {
|
|
64
|
+
let Sample = class Sample extends entity_1.Entity {
|
|
65
|
+
};
|
|
66
|
+
Sample = __decorate([
|
|
67
|
+
(0, entity_1.EntityDecorator)()
|
|
68
|
+
], Sample);
|
|
69
|
+
let entity = new Sample().attachToRoot();
|
|
70
|
+
entity_store_helper_1.EntityStoreHelper.registerEntity(entity);
|
|
71
|
+
entity_store_helper_1.EntityStoreHelper.unregisterEntity(Sample, entity.id);
|
|
72
|
+
(0, vitest_1.expect)(entity_store_helper_1.EntityStoreHelper.getEntity(Sample, entity.id)).toBeUndefined();
|
|
73
|
+
});
|
|
74
|
+
(0, vitest_1.test)('get entity', () => {
|
|
75
|
+
let Sample = class Sample extends entity_1.Entity {
|
|
76
|
+
};
|
|
77
|
+
Sample = __decorate([
|
|
78
|
+
(0, entity_1.EntityDecorator)()
|
|
79
|
+
], Sample);
|
|
80
|
+
let entity = new Sample().attachToRoot();
|
|
81
|
+
entity_store_helper_1.EntityStoreHelper.registerEntity(entity);
|
|
82
|
+
(0, vitest_1.expect)(entity_store_helper_1.EntityStoreHelper.getEntity(Sample, entity.id)).toBe(entity);
|
|
83
|
+
});
|
|
84
|
+
(0, vitest_1.test)('get entities', () => {
|
|
85
|
+
let Sample = class Sample extends entity_1.Entity {
|
|
86
|
+
};
|
|
87
|
+
Sample = __decorate([
|
|
88
|
+
(0, entity_1.EntityDecorator)()
|
|
89
|
+
], Sample);
|
|
90
|
+
let entity1 = new Sample().attachToRoot();
|
|
91
|
+
let entity2 = new Sample().attachToRoot();
|
|
92
|
+
entity_store_helper_1.EntityStoreHelper.registerEntity(entity1);
|
|
93
|
+
entity_store_helper_1.EntityStoreHelper.registerEntity(entity2);
|
|
94
|
+
(0, vitest_1.expect)(entity_store_helper_1.EntityStoreHelper.getEntities(Sample)).toEqual([entity1, entity2]);
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
(0, vitest_1.describe)('singleton operations', () => {
|
|
98
|
+
(0, vitest_1.test)('get singleton with success', () => {
|
|
99
|
+
let Sample = class Sample extends singleton_entity_1.SingletonEntity {
|
|
100
|
+
};
|
|
101
|
+
Sample = __decorate([
|
|
102
|
+
(0, entity_1.EntityDecorator)()
|
|
103
|
+
], Sample);
|
|
104
|
+
let entity = new Sample().attachToRoot();
|
|
105
|
+
entity_store_helper_1.EntityStoreHelper.registerEntity(entity);
|
|
106
|
+
(0, vitest_1.expect)(entity_store_helper_1.EntityStoreHelper.getSingleton(Sample)).toBe(entity);
|
|
107
|
+
});
|
|
108
|
+
(0, vitest_1.test)('get singleton with error', () => {
|
|
109
|
+
let Sample = class Sample extends singleton_entity_1.SingletonEntity {
|
|
110
|
+
};
|
|
111
|
+
Sample = __decorate([
|
|
112
|
+
(0, entity_1.EntityDecorator)()
|
|
113
|
+
], Sample);
|
|
114
|
+
(0, vitest_1.expect)(entity_store_helper_1.EntityStoreHelper.getSingleton(Sample)).toBeUndefined();
|
|
115
|
+
});
|
|
116
|
+
(0, vitest_1.test)('get singleton or fail with success', () => {
|
|
117
|
+
let Sample = class Sample extends singleton_entity_1.SingletonEntity {
|
|
118
|
+
};
|
|
119
|
+
Sample = __decorate([
|
|
120
|
+
(0, entity_1.EntityDecorator)()
|
|
121
|
+
], Sample);
|
|
122
|
+
let entity = new Sample().attachToRoot();
|
|
123
|
+
entity_store_helper_1.EntityStoreHelper.registerEntity(entity);
|
|
124
|
+
(0, vitest_1.expect)(entity_store_helper_1.EntityStoreHelper.getSingletonOrFail(Sample)).toBe(entity);
|
|
125
|
+
});
|
|
126
|
+
(0, vitest_1.test)('get singleton or fail with error', () => {
|
|
127
|
+
let Sample = class Sample extends singleton_entity_1.SingletonEntity {
|
|
128
|
+
};
|
|
129
|
+
Sample = __decorate([
|
|
130
|
+
(0, entity_1.EntityDecorator)()
|
|
131
|
+
], Sample);
|
|
132
|
+
(0, vitest_1.expect)(() => entity_store_helper_1.EntityStoreHelper.getSingletonOrFail(Sample)).toThrow();
|
|
133
|
+
});
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
//# sourceMappingURL=entity-store.helper.test.js.map
|
|
@@ -4,7 +4,7 @@ export declare class EntityViewsHelper {
|
|
|
4
4
|
private entity;
|
|
5
5
|
private static viewRegistries;
|
|
6
6
|
static currentEntityId: string;
|
|
7
|
-
static registerView<T>(ViewClass: ViewClassType<T>, EntityClass: EntityClassType): void;
|
|
7
|
+
static registerView<T extends Entity>(ViewClass: ViewClassType<T>, EntityClass: EntityClassType<T>): void;
|
|
8
8
|
private static createView;
|
|
9
9
|
private views;
|
|
10
10
|
constructor(entity: Entity);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.EntityViewsHelper = void 0;
|
|
4
4
|
const service_1 = require("../../service/service");
|
|
5
|
-
const
|
|
5
|
+
const unit_test_helper_1 = require("../../unit-test.helper");
|
|
6
6
|
const entity_store_helper_1 = require("./entity-store.helper");
|
|
7
7
|
class EntityViewsHelper {
|
|
8
8
|
static { this.viewRegistries = new Map(); }
|
|
@@ -60,7 +60,9 @@ class EntityViewsHelper {
|
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
exports.EntityViewsHelper = EntityViewsHelper;
|
|
63
|
-
|
|
63
|
+
unit_test_helper_1.UnitTestHelper.onHardReset
|
|
64
|
+
.subscribe(() => {
|
|
64
65
|
EntityViewsHelper['viewRegistries'] = new Map();
|
|
65
|
-
})
|
|
66
|
+
})
|
|
67
|
+
.attachToRoot();
|
|
66
68
|
//# sourceMappingURL=entity-views.helper.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Entity } from './entity';
|
|
1
|
+
import { Entity, EntityClassType } from './entity';
|
|
2
2
|
export declare abstract class SingletonEntity extends Entity {
|
|
3
|
-
static getInstance<T extends SingletonEntity>(this:
|
|
4
|
-
static getInstanceOrFail<T extends SingletonEntity>(this:
|
|
3
|
+
static getInstance<T extends SingletonEntity>(this: EntityClassType<T>): T | undefined;
|
|
4
|
+
static getInstanceOrFail<T extends SingletonEntity>(this: EntityClassType<T>): T;
|
|
5
5
|
constructor();
|
|
6
6
|
}
|
|
@@ -15,7 +15,7 @@ class SingletonEntity extends entity_1.Entity {
|
|
|
15
15
|
let entities = this.constructor.getEntities();
|
|
16
16
|
if (entities.length > 1) {
|
|
17
17
|
this.attachToRoot();
|
|
18
|
-
throw new Error(`SingletonEntity: entity is decorated as singleton but multiple instances are created!
|
|
18
|
+
throw new Error(`SingletonEntity: entity is decorated as singleton but multiple instances are created! "${this}"`);
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
}
|
|
@@ -1,45 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
2
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
19
3
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
20
4
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
21
5
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
22
6
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
23
7
|
};
|
|
24
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
25
|
-
if (mod && mod.__esModule) return mod;
|
|
26
|
-
var result = {};
|
|
27
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
28
|
-
__setModuleDefault(result, mod);
|
|
29
|
-
return result;
|
|
30
|
-
};
|
|
31
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
|
-
const ActionsLib = __importStar(require("actions-lib"));
|
|
33
9
|
const vitest_1 = require("vitest");
|
|
34
|
-
const decorate_actions_lib_1 = require("../base/helpers/decorate-actions-lib");
|
|
35
10
|
const scene_1 = require("../scene/scene");
|
|
36
|
-
const
|
|
11
|
+
const unit_test_helper_1 = require("../unit-test.helper");
|
|
37
12
|
const entity_1 = require("./entity");
|
|
38
13
|
const singleton_entity_1 = require("./singleton-entity");
|
|
39
|
-
decorate_actions_lib_1.ActionsLibDecorator.decorate(ActionsLib);
|
|
40
14
|
(0, vitest_1.describe)('SINGLETON ENTITY', () => {
|
|
41
15
|
(0, vitest_1.beforeEach)(() => {
|
|
42
|
-
|
|
16
|
+
unit_test_helper_1.UnitTestHelper.hardReset();
|
|
43
17
|
let SampleScene = class SampleScene extends scene_1.Scene {
|
|
44
18
|
async init() { }
|
|
45
19
|
update() { }
|
|
@@ -83,6 +57,5 @@ decorate_actions_lib_1.ActionsLibDecorator.decorate(ActionsLib);
|
|
|
83
57
|
new Sample().attach(baseEntity);
|
|
84
58
|
(0, vitest_1.expect)(() => new Sample()).toThrow();
|
|
85
59
|
});
|
|
86
|
-
// TODO: test continuesSubscription
|
|
87
60
|
});
|
|
88
61
|
//# sourceMappingURL=singleton-entity.test.js.map
|