@woosh/meep-engine 2.75.1 → 2.75.2
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/build/meep.module.js
CHANGED
|
@@ -117813,6 +117813,7 @@ class SelectorBehavior extends CompositeBehavior {
|
|
|
117813
117813
|
}
|
|
117814
117814
|
|
|
117815
117815
|
initialize(context) {
|
|
117816
|
+
|
|
117816
117817
|
const children = this.__children;
|
|
117817
117818
|
|
|
117818
117819
|
if (children.length > 0) {
|
|
@@ -117820,7 +117821,7 @@ class SelectorBehavior extends CompositeBehavior {
|
|
|
117820
117821
|
this.__currentBehaviourIndex = 0;
|
|
117821
117822
|
this.__currentBehaviour = children[0];
|
|
117822
117823
|
|
|
117823
|
-
this.__currentBehaviour.initialize(
|
|
117824
|
+
this.__currentBehaviour.initialize(context);
|
|
117824
117825
|
|
|
117825
117826
|
} else {
|
|
117826
117827
|
// no children
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { CompositeBehavior } from "./composite/CompositeBehavior.js";
|
|
2
|
-
import { BehaviorStatus } from "./BehaviorStatus.js";
|
|
3
1
|
import { assert } from "../../../core/assert.js";
|
|
2
|
+
import { BehaviorStatus } from "./BehaviorStatus.js";
|
|
3
|
+
import { CompositeBehavior } from "./composite/CompositeBehavior.js";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Will try every child behaviour in order until one succeeds or if all fail - the selector behavior will fail too
|
|
@@ -83,6 +83,7 @@ export class SelectorBehavior extends CompositeBehavior {
|
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
initialize(context) {
|
|
86
|
+
|
|
86
87
|
const children = this.__children;
|
|
87
88
|
|
|
88
89
|
if (children.length > 0) {
|
|
@@ -90,7 +91,7 @@ export class SelectorBehavior extends CompositeBehavior {
|
|
|
90
91
|
this.__currentBehaviourIndex = 0;
|
|
91
92
|
this.__currentBehaviour = children[0];
|
|
92
93
|
|
|
93
|
-
this.__currentBehaviour.initialize(
|
|
94
|
+
this.__currentBehaviour.initialize(context);
|
|
94
95
|
|
|
95
96
|
} else {
|
|
96
97
|
// no children
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Behavior } from "./Behavior.js";
|
|
2
|
+
import { SelectorBehavior } from "./SelectorBehavior.js";
|
|
3
|
+
|
|
4
|
+
test("correctly passes context to children during initialization", () => {
|
|
5
|
+
|
|
6
|
+
const child = new Behavior();
|
|
7
|
+
|
|
8
|
+
const selector = SelectorBehavior.from([
|
|
9
|
+
child
|
|
10
|
+
]);
|
|
11
|
+
|
|
12
|
+
const ctx = { a: 7 };
|
|
13
|
+
|
|
14
|
+
selector.initialize(ctx)
|
|
15
|
+
|
|
16
|
+
expect(child.context).toEqual(ctx);
|
|
17
|
+
|
|
18
|
+
});
|