Pool <Type>
Index
Constructors
Properties
Methods
Constructors
constructor
Type parameters
- Type
Parameters
builder: () => Type
recycler: (instance: Type) => Type
maxObjects: number = 100
Returns Pool<Type>
Properties
publicbuilder
Type declaration
Returns Type
publicdisableWarnings
publicindex
publicmaxObjects
publicobjects
publicrecycler
Type declaration
Parameters
instance: Type
Returns Type
publictotalAllocations
Methods
borrow
Parameters
context: (object: Type) => void
Returns void
dispose
Returns void
done
Signals we are done with the pool objects for now, Reclaims all objects in the pool.
If a list of pooled objects is passed to done they are un-hooked from the pool and are free to be passed to consumers
Parameters
rest...objects: Type[]
A list of object to separate from the pool
Returns Type[]
get
Retrieve a value from the pool, will allocate a new instance if necessary or recycle from the pool
Returns Type
preallocate
Returns void
using
Use many instances out of the in the context and return all to the pool.
By returning values out of the context they will be un-hooked from the pool and are free to be passed to consumers
Parameters
context: (pool: Pool<Type>) => void | Type[]
Returns Type[]
Use a single instance out of th pool and immediately return it to the pool