Class: PoolGroupClass

PoolGroupClass

A group of pools that can be used to store objects of different types.

new PoolGroupClass ()

Methods

get (Class, data) T

Gets an item from a specific pool.

Name Type Attributes Description
Class PoolItemConstructor<T>

The constructor of the items in the pool.

data unknown <optional>

Optional data to pass to the item's constructor.

Returns:
Type Description
T The item from the pool.

getPool (ClassType) Pool<T>

Gets a specific pool based on the class type.

Name Type Description
ClassType PoolItemConstructor<T>

The constructor of the items in the pool.

Returns:
Type Description
Pool<T> The pool of the given class type.

prepopulate (Class, total) void

Prepopulates a specific pool with a given number of items.

Name Type Description
Class PoolItemConstructor<T>

The constructor of the items in the pool.

total number

The number of items to add to the pool.

return (item) void

Returns an item to its respective pool.

Name Type Description
item PoolItem

The item to return to the pool.

stats () Record<string, { free : number, used : number, size : number }>

gets the usage stats of each pool in the system

Returns:
Type Description
Record<string, { free : number, used : number, size : number }>