File tree Expand file tree Collapse file tree 1 file changed +17
-17
lines changed
Expand file tree Collapse file tree 1 file changed +17
-17
lines changed Original file line number Diff line number Diff line change @@ -4,35 +4,35 @@ const STEP_MS = 35
44const MAX_VALUE = 1
55
66export class ProgressManager {
7- #autoplayDuration
8- #onProgressValueChange
9-
10- #interval
11- #paused = false
12-
137 constructor ( { onProgressValueChange } ) {
14- this . #onProgressValueChange = onProgressValueChange
8+ this . _onProgressValueChange = onProgressValueChange
9+
10+ this . _autoplayDuration
11+ this . _onProgressValueChange
12+
13+ this . _interval
14+ this . _paused = false
1515 }
1616
1717 setAutoplayDuration ( autoplayDuration ) {
18- this . #autoplayDuration = autoplayDuration
18+ this . _autoplayDuration = autoplayDuration
1919 }
2020
2121 start ( onFinish ) {
2222 return new Promise ( ( resolve ) => {
2323 this . reset ( )
2424
25- const stepMs = Math . min ( STEP_MS , this . #autoplayDuration )
25+ const stepMs = Math . min ( STEP_MS , this . _autoplayDuration )
2626 let progress = - stepMs
2727
28- this . #interval = setIntervalImmediate ( async ( ) => {
29- if ( this . #paused ) {
28+ this . _interval = setIntervalImmediate ( async ( ) => {
29+ if ( this . _paused ) {
3030 return
3131 }
3232 progress += stepMs
3333
34- const value = progress / this . #autoplayDuration
35- this . #onProgressValueChange ( value )
34+ const value = progress / this . _autoplayDuration
35+ this . _onProgressValueChange ( value )
3636
3737 if ( value > MAX_VALUE ) {
3838 this . reset ( )
@@ -44,15 +44,15 @@ export class ProgressManager {
4444 }
4545
4646 pause ( ) {
47- this . #paused = true
47+ this . _paused = true
4848 }
4949
5050 resume ( ) {
51- this . #paused = false
51+ this . _paused = false
5252 }
5353
5454 reset ( ) {
55- clearInterval ( this . #interval )
56- this . #onProgressValueChange ( MAX_VALUE )
55+ clearInterval ( this . _interval )
56+ this . _onProgressValueChange ( MAX_VALUE )
5757 }
5858}
You can’t perform that action at this time.
0 commit comments