Pool
An object pool implementation. Used for pooling objects to avoid unnecessary garbage collection.
Constructor Summary
| Public Constructor | ||
| public |
constructor(): * Constructs a Pool instance. |
|
Member Summary
| Public Members | ||
| public |
cID: integer Incrementing id that keeps a count of the number of objects created |
|
| public |
Map of pools in the format of PUID<String>: pool<Array> |
|
| public |
The class type. |
|
Method Summary
| Public Methods | ||
| public |
canCloneObject(object: object): boolean Determines if the object is able to be cloned or not. |
|
| public |
canCreateNewObject(object: object): boolean Determines if a new object is able to be created. |
|
| public |
canInstantiateObject(object: object): boolean Determines if the object is able to be instantiated or not. |
|
| public |
Attempts to create a new object either by creating a new instance or calling its clone method. |
|
| public |
destroy(): * Destroys all pools. |
|
| public |
Pushes an object into the pool. |
|
| public |
Gets an object either by creating a new one or retrieving it from the pool. |
|
| public |
getCount(): integer Gets a count of all objects in the pool. |
|
| Private Methods | ||
| private |
Gets the pool mapped to the UID. |
|
Public Constructors
Public Members
Public Methods
public canCloneObject(object: object): boolean source
Determines if the object is able to be cloned or not.
Params:
| Name | Type | Attribute | Description |
| object | object | The object to check |
public canCreateNewObject(object: object): boolean source
Determines if a new object is able to be created.
Params:
| Name | Type | Attribute | Description |
| object | object | The object to check |
public canInstantiateObject(object: object): boolean source
Determines if the object is able to be instantiated or not.
Params:
| Name | Type | Attribute | Description |
| object | object | The object to check |
public create(functionOrObject: function | object): object | undefined source
Attempts to create a new object either by creating a new instance or calling its clone method.
TODO COVERAGE - for the constructorArgs
public expire(obj: object): integer source
Pushes an object into the pool.
Params:
| Name | Type | Attribute | Description |
| obj | object | The object to expire |
Return:
| integer |
public get(obj: function | object, args: array): object source
Gets an object either by creating a new one or retrieving it from the pool.
