Skip to content

Commit

Permalink
fix disposable error
Browse files Browse the repository at this point in the history
  • Loading branch information
Gorniaky committed Mar 4, 2024
1 parent fa8af6c commit 289005d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/structures/DisposableMap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ export default class DisposableMap<K, V extends Disposable> extends Map<K, V> {
dispose(key?: K) {
if (key === undefined) {
for (const disposable of this.values()) {
disposable.dispose();
disposable.dispose?.();
}
this.clear();
} else {
const existing = this.get(key);

if (existing) {
existing.dispose();
existing.dispose?.();
return this.delete(key);
}

Expand Down

0 comments on commit 289005d

Please sign in to comment.