Skip to content

Commit

Permalink
Add reset method
Browse files Browse the repository at this point in the history
  • Loading branch information
davidjerleke committed Jan 14, 2024
1 parent 705da45 commit e6953b6
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export type AutoScrollType = CreatePluginType<
{
play: (delay?: number) => void
stop: () => void
reset: () => void
isPlaying: () => boolean
},
OptionsType
Expand Down Expand Up @@ -228,6 +229,13 @@ function AutoScroll(userOptions: AutoScrollOptionsType = {}): AutoScrollType {
if (playing) stopScroll()
}

function reset(): void {
if (playing) {
stopScroll()
startScrollOnSettle()
}
}

function isPlaying(): boolean {
return playing
}
Expand All @@ -239,6 +247,7 @@ function AutoScroll(userOptions: AutoScrollOptionsType = {}): AutoScrollType {
destroy,
play,
stop,
reset,
isPlaying
}
return self
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,15 @@ Stops auto scroll.

---

### reset

Parameters: <BrandPrimaryText>`none`</BrandPrimaryText>
Returns: <BrandSecondaryText>`void`</BrandSecondaryText>

Stops auto scroll and starts over. This will only take effect if auto scroll is playing. If auto scroll is stopped, this method won't trigger anything.

---

### isPlaying

Parameters: <BrandPrimaryText>`none`</BrandPrimaryText>
Expand Down

0 comments on commit e6953b6

Please sign in to comment.