#45 : Add const

This commit is contained in:
Vadim
2021-07-18 16:21:38 +03:00
parent 00e0a2a471
commit d9fdd87873

View File

@@ -1,6 +1,8 @@
import { setIntervalImmediate } from './interval' import { setIntervalImmediate } from './interval'
const STEP_MS = 35 const STEP_MS = 35
const MAX_VALUE = 1
export class ProgressManager { export class ProgressManager {
#autoplayDuration #autoplayDuration
#onProgressValueChange #onProgressValueChange
@@ -32,7 +34,7 @@ export class ProgressManager {
const value = progress / this.#autoplayDuration const value = progress / this.#autoplayDuration
this.#onProgressValueChange(value) this.#onProgressValueChange(value)
if (value > 1) { if (value > MAX_VALUE) {
this.reset() this.reset()
await onFinish() await onFinish()
resolve() resolve()
@@ -51,6 +53,6 @@ export class ProgressManager {
reset() { reset() {
clearInterval(this.#interval) clearInterval(this.#interval)
this.#onProgressValueChange(1) this.#onProgressValueChange(MAX_VALUE)
} }
} }