Skip to content

Commit 30332ab

Browse files
committed
fix: poolContainer注入通过on来监听
1 parent 9bf2af8 commit 30332ab

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

packages/shared/src/construct.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,12 @@ export const construct = (target: Function, params: unknown[] = []) => {
1010
const instance = Reflect.construct(target, params)
1111
const instanceContainer = poolContainer.use(target.prototype)
1212
if (!isBoolean(instanceContainer)) {
13-
for (let [key, value] of instanceContainer.getPool().entries()) {
14-
defineProperty(instance, key, value)
13+
for (let key in instance) {
14+
if (instance.hasOwnProperty(key)) {
15+
instanceContainer.on(key, (inject) => {
16+
defineProperty(instance, key, inject)
17+
})
18+
}
1519
}
1620
}
1721
return instance

0 commit comments

Comments
 (0)