This commit is contained in:
zsviczian
2024-07-22 22:01:36 +02:00
parent f543e3218e
commit de39053857
8 changed files with 37 additions and 8 deletions

View File

@@ -15,4 +15,15 @@ export class WeakArray<T extends object> {
}
});
}
removeObjects(objectsToRemove: Set<T>) {
this.weakArray = this.weakArray.filter((ref) => {
const obj = ref.deref();
return obj && !objectsToRemove.has(obj);
});
}
clear() {
this.weakArray = [];
}
}