Pool

Pool

new Pool(number, create)

Source:
Parameters:
Name Type Default Description
number number 100 Number of objects to create at the initialization.
create

Classes

Pool

Members

_pool :Array.<T>

Description:
  • List of objects
Source:
List of objects
Type:
  • Array.<T>

size :number

Description:
  • The number of objects available in the pool.
Source:
The number of objects available in the pool.
Type:
  • number

Methods

(protected) create()

Description:
  • Creates a new object.
Source:
Returns:
T

give() → {T}

Description:
  • Gives an object ownership.
Source:
Returns:
Type
T

take(obj)

Description:
  • Takes an object's ownership. Do not use the taken object and remove all references of it outside otherwise you will get some wierd behaviour.
Source:
Parameters:
Name Type Description
obj T