* Get object from pool or create new one * 从池中获取对象或创建新对象 * * @param url Resource URL | 资源 URL * @returns GObject instance or null | GObject 实例或 null
(url: string)
| 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 |
no test coverage detected