Constructor
new Pool(obj, size)
The Pool constructor.
Parameters:
Name | Type | Description |
---|---|---|
obj |
Template | The template to use. |
size |
number | The number of objects to create. |
Methods
allocate() → {Object}
Get a new object.
Returns:
The new allocated object.
- Type
- Object
free(obj) → {undefined}
Free an object for later use.
Parameters:
Name | Type | Description |
---|---|---|
obj |
Object | The obejct to free. |
Throws:
-
The item was not found in the pool.
- Type
- Error
Returns:
- Type
- undefined
Type Definitions
Template
A template to use for an object pool.
Type:
- Object