Skip to content
This repository was archived by the owner on Jun 29, 2022. It is now read-only.
This repository was archived by the owner on Jun 29, 2022. It is now read-only.

[quality] Align DisposableCollection with Theia? #14

@kittaakos

Description

@kittaakos

The DisposableCollection is cool and convenient to use, however, what we have fixed in Theia never got back to here. Time to update or publish the DisposableCollection to npmjs and we do not have to copy-paste the code over and over.

See the diffs:

protected readonly disposables: Disposable[] = [];
dispose(): void {
while (this.disposables.length !== 0) {
this.disposables.pop()!.dispose();
}
}
push(disposable: Disposable): Disposable {
const disposables = this.disposables;
disposables.push(disposable);
return {
dispose(): void {
const index = disposables.indexOf(disposable);
if (index !== -1) {
disposables.splice(index, 1);
}
}
}
}
}

https://github.com/eclipse-theia/theia/blob/c4b4d3995ba81a80e36cd62d290dce2b23c8fd82/packages/core/src/common/disposable.ts#L38-L102

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions