#31 : Rename onValueChange -> onProgressValueChange

This commit is contained in:
Vadim
2021-07-03 22:40:30 +03:00
parent 1cca2162ac
commit 04d155823c
2 changed files with 5 additions and 5 deletions

View File

@@ -134,7 +134,7 @@
let progressValue let progressValue
const progressManager = new ProgressManager({ const progressManager = new ProgressManager({
autoplayDuration, autoplayDuration,
onValueChange: (value) => { onProgressValueChange: (value) => {
progressValue = 1 - value progressValue = 1 - value
} }
}) })

View File

@@ -4,17 +4,17 @@ const PROGRESS_STEPS_COUNT = 100
export class ProgressManager { export class ProgressManager {
#autoplayDuration #autoplayDuration
#onValueChange #onProgressValueChange
#interval #interval
#paused = false #paused = false
constructor({ constructor({
autoplayDuration, autoplayDuration,
onValueChange, onProgressValueChange,
}) { }) {
this.#autoplayDuration = autoplayDuration this.#autoplayDuration = autoplayDuration
this.#onValueChange = onValueChange this.#onProgressValueChange = onProgressValueChange
} }
start(onFinish) { start(onFinish) {
@@ -30,7 +30,7 @@ export class ProgressManager {
progress += stepMs progress += stepMs
const value = progress / this.#autoplayDuration const value = progress / this.#autoplayDuration
this.#onValueChange(value) this.#onProgressValueChange(value)
if (value > 1) { if (value > 1) {
this.reset() this.reset()