vscode-ws-jsonrpc
Version:
VSCode JSON RPC over WebSocket
25 lines • 897 B
JavaScript
/* --------------------------------------------------------------------------------------------
* Copyright (c) 2024 TypeFox and others.
* Licensed under the MIT License. See LICENSE in the package root for license information.
* ------------------------------------------------------------------------------------------ */
export class DisposableCollection {
disposables = [];
dispose() {
while (this.disposables.length !== 0) {
this.disposables.pop().dispose();
}
}
push(disposable) {
const disposables = this.disposables;
disposables.push(disposable);
return {
dispose() {
const index = disposables.indexOf(disposable);
if (index !== -1) {
disposables.splice(index, 1);
}
}
};
}
}
//# sourceMappingURL=disposable.js.map