Options
All
  • Public
  • Public/Protected
  • All
Menu

Class DisposableSet

An object which manages a collection of disposable items. The namespace for the DisposableSet class statics.

Hierarchy

  • DisposableSet

Implements

Index

Constructors

Properties

Accessors

Methods

Constructors

constructor

Properties

Private _disposed

_disposed: boolean = false

Private _items

_items: Set<IDisposable> = new Set<IDisposable>()

Accessors

isDisposed

  • get isDisposed(): boolean
  • Test whether the set has been disposed.

    Returns boolean

Methods

add

  • Add a disposable item to the set.

    Parameters

    • item: IDisposable

      The item to add to the set.

      Notes

      If the item is already contained in the set, this is a no-op.

    Returns void

clear

  • clear(): void
  • Remove all items from the set.

    Returns void

contains

  • Test whether the set contains a specific item.

    Parameters

    Returns boolean

    true if the set contains the item, false otherwise.

dispose

  • dispose(): void
  • Dispose of the set and the items it contains.

    Notes

    Items are disposed in the order they are added to the set.

    Returns void

remove

  • Remove a disposable item from the set.

    Parameters

    • item: IDisposable

      The item to remove from the set.

      Notes

      If the item is not contained in the set, this is a no-op.

    Returns void

Static from

  • Create a disposable set from an iterable of items.

    Parameters

    • items: IterableOrArrayLike<IDisposable>

      The iterable or array-like object of interest.

    Returns DisposableSet

    A new disposable initialized with the given items.

Generated using TypeDoc