Class: Pool<T, I>
Defined in: node_modules/pixi.js/lib/utils/pool/Pool.d.ts:8
A generic class for managing a pool of items.
Advanced
Type Parameters
T
T extends PoolItem
The type of items in the pool. Must implement PoolItem.
I
I = Parameters<NonNullable<T["init"]>>[0]
The type of argument passed to item's init method if it exists.
Constructors
Constructor
> new Pool<T, I>(ClassType, initialSize?): Pool<T, I>
Defined in: node_modules/pixi.js/lib/utils/pool/Pool.d.ts:19
Constructs a new Pool.
Parameters
ClassType
The constructor of the items in the pool.
initialSize?
number
The initial size of the pool.
Returns
Pool<T, I>
Properties
_classType
> readonly _classType: PoolItemConstructor<T>
Defined in: node_modules/pixi.js/lib/utils/pool/Pool.d.ts:10
Internal
Accessors
totalFree
Get Signature
> get totalFree(): number
Defined in: node_modules/pixi.js/lib/utils/pool/Pool.d.ts:46
Gets the number of items in the pool that are free to use without needing to create more.
Returns
number
totalSize
Get Signature
> get totalSize(): number
Defined in: node_modules/pixi.js/lib/utils/pool/Pool.d.ts:41
Gets the number of items in the pool.
Returns
number
totalUsed
Get Signature
> get totalUsed(): number
Defined in: node_modules/pixi.js/lib/utils/pool/Pool.d.ts:51
Gets the number of items in the pool that are currently in use.
Returns
number
Methods
clear()
> clear(): void
Defined in: node_modules/pixi.js/lib/utils/pool/Pool.d.ts:53
clears the pool
Returns
void
get()
> get(data?): T
Defined in: node_modules/pixi.js/lib/utils/pool/Pool.d.ts:31
Gets an item from the pool. Calls the item's init method if it exists.
If there are no items left in the pool, a new one will be created.
Parameters
data?
I
Optional data to pass to the item's constructor.
Returns
T
The item from the pool.
prepopulate()
> prepopulate(total): void
Defined in: node_modules/pixi.js/lib/utils/pool/Pool.d.ts:24
Prepopulates the pool with a given number of items.
Parameters
total
number
The number of items to add to the pool.
Returns
void
return()
> return(item): void
Defined in: node_modules/pixi.js/lib/utils/pool/Pool.d.ts:36
Returns an item to the pool. Calls the item's reset method if it exists.
Parameters
item
T
The item to return to the pool.
Returns
void