@wopjs/disposable - v0.1.24
    Preparing search index...

    Interface DisposableArray

    A Disposable Array is an IDisposable store that manages Disposers and IDisposables in array order.

    This structure is optimized for frequent push operations.

    A DisposableArray is also a Disposer, which means it can be the dispose method of an IDisposable.

    A DisposableArray is also an IDisposable, which means it can be managed by another disposable container.

    interface DisposableArray {
        dispose(this: void): void;
        flush(disposable?: DisposableType): void;
        has(disposable: DisposableType): boolean;
        make<T extends DisposableType>(executor: () => T): T;
        make<T extends DisposableType>(
            executor: () => void | T | null | undefined,
        ): void | T;
        make<T extends DisposableType[]>(executor: () => T): T;
        make<T extends DisposableType[]>(
            executor: () => void | T | null | undefined,
        ): void | T;
        push<T extends DisposableType>(disposable: T): T;
        push<T extends DisposableType[]>(disposables: T): T;
        push<T extends DisposableType>(disposables: T | T[]): T | T[];
        remove(disposable: DisposableType): boolean;
        size(): number;
        (): void;
        (): any;
    }

    Hierarchy (View Summary)

    Index
    • Invoke the executor and push the returned disposable to the array.

      Type Parameters

      Parameters

      • executor: () => T

        A function that returns a disposable.

      Returns T

      The returned disposable.

    • Invoke the executor and push the returned disposable to the array.

      Do nothing if null | undefined is returned.

      Type Parameters

      Parameters

      • executor: () => void | T | null | undefined

        A function that returns either a disposable or null | undefined.

      Returns void | T

      The returned disposable, or undefined.

    • Invoke the executor and push each returned disposable to the array.

      Type Parameters

      Parameters

      • executor: () => T

        A function that returns an array of disposables.

      Returns T

      The returned array.

    • Invoke the executor and push each returned disposable to the array.

      Do nothing if null | undefined is returned.

      Type Parameters

      Parameters

      • executor: () => void | T | null | undefined

        A function that returns an array of disposables or null | undefined.

      Returns void | T

      The returned array, or undefined.