Class: Pool

Pool(obj, size)

An object pool class.

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.

Source:

Methods

allocate() → {Object}

Get a new object.

Source:
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.

Source:
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
Source: