Class Resource<V>

A resource allocated in the Pool

Type Parameters

  • V

Constructors

  • Constructor.

    Type Parameters

    • V

    Parameters

    • pool: Pool<V>

      Pool

    • data: V

      Data

    Returns Resource<V>

Properties

pool: Pool<V>

Pool

Accessors

  • get data(): V
  • Gets data associated with resource. Throws an error if disposed

    Returns V

  • get hasUserCapacity(): boolean
  • Returns true if resource can have additional users allocated

    Returns boolean

  • get isDisposed(): boolean
  • Returns true if instance is disposed

    Returns boolean

  • get isExpiredFromUsers(): boolean
  • Returns true if automatic expiry is enabled, and that interval has elapsed since the users list has changed for this resource

    Returns boolean

  • get usersCount(): number
  • Returns number of uses of the resource

    Returns number

Methods

  • Disposes the resource. If it is already disposed, it does nothing.

    Parameters

    • reason: string

    Returns void

  • Returns a human-readable debug string for resource

    Returns string

  • Changes the data associated with this resource. Throws an error if disposed or data is undefined.

    Parameters

    • data: V

    Returns void