rename append for objects to update

This commit is contained in:
Niels Lyngsø
2023-01-20 14:58:06 +01:00
parent 445f0aab5d
commit f27bdee03c
2 changed files with 3 additions and 3 deletions

View File

@@ -44,8 +44,8 @@ describe('UniqueObjectBehaviorSubject', () => {
}
});
subject.append({key: 'change_this_first_should_not_trigger_update'});
subject.append({another: 'myNewValue'});
subject.update({key: 'change_this_first_should_not_trigger_update'});
subject.update({another: 'myNewValue'});
});

View File

@@ -20,7 +20,7 @@ export class UniqueObjectBehaviorSubject<T> extends UniqueBehaviorSubject<T> {
* const mySubject = new UniqueObjectBehaviorSubject(data)
* mySubject.append({value: 'myNewValue'})
*/
append(partialData: Partial<T>) {
update(partialData: Partial<T>) {
this.next({ ...this.getValue(), ...partialData });
}
}