mirror of
https://github.com/Equicord/Equicord.git
synced 2025-06-17 10:27:03 -04:00
Dedicated Updater Page, Settings feedback
This commit is contained in:
parent
cac77dce40
commit
2410582cf8
7 changed files with 143 additions and 83 deletions
24
src/utils/ChangeList.ts
Normal file
24
src/utils/ChangeList.ts
Normal 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);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue