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

Method getObject

packages/fairygui/src/core/GObjectPool.ts:45–56  ·  view source on GitHub ↗

* Get object from pool or create new one * 从池中获取对象或创建新对象 * * @param url Resource URL | 资源 URL * @returns GObject instance or null | GObject 实例或 null

(url: string)

Source from the content-addressed store, hash-verified

43 * @returns GObject instance or null | GObject 实例或 null
44 */
45 public getObject(url: string): GObject | null {
46 url = UIPackage.normalizeURL(url);
47 if (!url) return null;
48
49 const arr = this._pool.get(url);
50 if (arr && arr.length > 0) {
51 this._count--;
52 return arr.shift()!;
53 }
54
55 return UIPackage.createObjectFromURL(url);
56 }
57
58 /**
59 * Return object to pool

Callers 2

setErrorStateMethod · 0.80
getFromPoolMethod · 0.80

Calls 3

normalizeURLMethod · 0.80
getMethod · 0.65
createObjectFromURLMethod · 0.45

Tested by

no test coverage detected