MCPcopy Create free account
hub / github.com/esengine/esengine / createInstance

Function createInstance

packages/core/src/Core/DI/Decorators.ts:232–243  ·  view source on GitHub ↗
(
    constructor: new (...args: any[]) => T,
    container: ServiceContainer
)

Source from the content-addressed store, hash-verified

230 * ```
231 */
232export function createInstance<T>(
233 constructor: new (...args: any[]) => T,
234 container: ServiceContainer
235): T {
236 // 创建实例(无参数注入)
237 const instance = new constructor();
238
239 // 注入属性依赖
240 injectProperties(instance as object, container);
241
242 return instance;
243}
244
245/**
246 * 为实例注入属性依赖

Callers 5

constructorMethod · 0.90
enableDebugMethod · 0.90
addEntityProcessorMethod · 0.90
DI.test.tsFile · 0.90
factoryFunction · 0.85

Calls 1

injectPropertiesFunction · 0.85

Tested by

no test coverage detected