UseCreateAutoDisposedViewModel for audio player (#31503)

* refactor: useCreateAutoDisposedViewModel for audio player

* Update src/viewmodels/audio/AudioPlayerViewModel.ts

Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>

---------

Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Florian Duros
2025-12-11 16:41:27 +01:00
committed by GitHub
parent cd71c109d3
commit 23fbe9cef6
3 changed files with 22 additions and 8 deletions
@@ -141,4 +141,13 @@ export class AudioPlayerViewModel
public onSeekbarChange = async (ev: ChangeEvent<HTMLInputElement>): Promise<void> => {
await this.props.playback.skipTo((Number(ev.target.value) / 100) * this.props.playback.durationSeconds);
};
/**
* Updates the properties of the view model and recomputes the snapshot.
* @param newProps
*/
public setProps(newProps: Partial<Props>): void {
this.props = { ...this.props, ...newProps };
this.setSnapshot();
}
}