Class Pool<T>Abstract

Object pooling utility.

Type Parameters

  • T

Hierarchy

Constructors

Properties

Methods

Constructors

  • Type Parameters

    • T

    Parameters

    Returns Pool<T>

Properties

objects: T[] = []

Methods

  • Creates a new object in the pool

    Returns T

  • Destroys an object

    Parameters

    • object: T

      the object to destroy

    Returns void

  • Get an object from the pool or create a new instance.

    Returns T

    an object from the pool

  • Release an object back to the pool.

    Parameters

    • object: T

    Returns Pool<T>

    Self for chaining

  • Resizes the pool

    Parameters

    • size: number

    Returns Pool<T>

    Self, for chaining