Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Pool<T> Abstract

Object pooling utility.

Type Parameters

  • T

Hierarchy

Index

Constructors

  • Type Parameters

    • T

    Parameters

    Returns Pool<T>

Properties

objects: T[] = []

Methods

  • create(): T
  • Creates a new object in the pool

    Returns T

  • destroy(object: T): void
  • Destroys an object

    Parameters

    • object: T

      the object to destroy

    Returns void

  • get(): T
  • Get an object from the pool or create a new instance.

    Returns T

    an object from the pool

  • release(object: T): Pool<T>
  • Release an object back to the pool.

    Parameters

    • object: T

    Returns Pool<T>

    Self for chaining

  • resize(size: number): Pool<T>
  • Resizes the pool

    Parameters

    • size: number

    Returns Pool<T>

    Self, for chaining