Skip to content

Commit 674f78b

Browse files
committed
Fix component bug
1 parent df94566 commit 674f78b

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "whs",
3-
"version": "2.1.8-vrfix.3",
3+
"version": "2.1.8",
44
"description": "Super-fast 3D framework for Web Applications & Games. Based on Three.js",
55
"main": "build/whs.js",
66
"jsnext:main": "build/whs.module.js",

src/core/Component.js

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -150,21 +150,23 @@ class Component extends ModuleSystem {
150150
object.parent = this;
151151

152152
return new Promise((resolve, reject) => {
153-
object.defer(() => {
154-
const {native} = object;
155-
if (!native) reject();
153+
this.defer(() => {
154+
object.defer(() => {
155+
const {native} = object;
156+
if (!native) reject();
156157

157-
const addPromise = this.applyBridge({onAdd: object}).onAdd;
158+
const addPromise = this.applyBridge({onAdd: object}).onAdd;
158159

159-
const resolver = () => {
160-
this.native.add(native);
161-
this.children.push(object);
160+
const resolver = () => {
161+
this.native.add(native);
162+
this.children.push(object);
162163

163-
resolve(object);
164-
};
164+
resolve(object);
165+
};
165166

166-
if (addPromise instanceof Promise) addPromise.then(resolver);
167-
else resolver();
167+
if (addPromise instanceof Promise) addPromise.then(resolver);
168+
else resolver();
169+
});
168170
});
169171
});
170172
}

0 commit comments

Comments
 (0)