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

Method acquire

packages/core/src/ECS/Core/ComponentPool.ts:36–46  ·  view source on GitHub ↗

* 获取一个组件实例

()

Source from the content-addressed store, hash-verified

34 * 获取一个组件实例
35 */
36 acquire(): T {
37 this.stats.totalAcquired++;
38
39 if (this.pool.length > 0) {
40 return this.pool.pop()!;
41 }
42
43 this.stats.totalCreated++;
44
45 return this.createFn();
46 }
47
48 /**
49 * 释放一个组件实例回池中

Callers 2

acquireComponentMethod · 0.45

Calls 1

popMethod · 0.80

Tested by

no test coverage detected