Dedicated Updater Page, Settings feedback

This commit is contained in:
Vendicated 2022-10-01 22:09:20 +02:00
parent cac77dce40
commit 2410582cf8
No known key found for this signature in database
GPG key ID: EC781ADFB93EFFA3
7 changed files with 143 additions and 83 deletions

24
src/utils/ChangeList.ts Normal file
View file

@ -0,0 +1,24 @@
export class ChangeList<T>{
private set = new Set<T>;
public get changeCount() {
return this.set.size;
}
public get hasChanges() {
return this.changeCount > 0;
}
public handleChange(item: T) {
if (!this.set.delete(item))
this.set.add(item);
}
public getChanges() {
return this.set.values();
}
public map<R>(mapper: (v: T, idx: number, arr: T[]) => R): R[] {
return [...this.getChanges()].map(mapper);
}
}