Interface IObjectPool<T>

A pool of objects whose disposable lifecycle is tracked.

Typeparam

T - The type of object held in the pool.

Type Parameters

Hierarchy

Implemented by

Properties

added: ISignal<IObjectPool<T>, T>

A signal emitted when an object is added.

This signal does not emit if an object is added using inject().

current: T

The current object.

currentChanged: ISignal<IObjectPool<T>, T>

A signal emitted when the current object changes.

Notes

If the last object being tracked is disposed, null will be emitted.

isDisposed: boolean

Test whether the object has been disposed.

Notes

This property is always safe to access.

size: number

The number of objects held by the pool.

updated: ISignal<IObjectPool<T>, T>

A signal emitted when an object is updated.

Methods

  • Dispose of the resources held by the object.

    Notes

    If the object's dispose method is called more than once, all calls made after the first will be a no-op.

    Undefined Behavior

    It is undefined behavior to use any functionality of the object after it has been disposed unless otherwise explicitly noted.

    Returns void

  • Filter the objects in the pool based on a predicate.

    Parameters

    • fn: ((obj) => boolean)

      The function by which to filter.

        • (obj): boolean
        • Parameters

          • obj: T

          Returns boolean

    Returns T[]

  • Find the first object in the pool that satisfies a filter function.

    Parameters

    • fn: ((obj) => boolean)
        • (obj): boolean
        • Parameters

          • obj: T

          Returns boolean

    Returns T

  • Iterate through each object in the pool.

    Parameters

    • fn: ((obj) => void)

      The function to call on each object.

        • (obj): void
        • Parameters

          • obj: T

          Returns void

    Returns void

  • Check if this pool has the specified object.

    Parameters

    • obj: T

      The object whose existence is being checked.

    Returns boolean

Generated using TypeDoc