be-fe / be-fe/iSlider

发现bug一枚,pause()方法有问题的

Open
#436 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
1.6k
Forks
441
PR merge metrics
No merged PRs in 30d

Description

如题 ~

pause只是清理了this._LSN.autoPlay上的当前计时器,如果执行pause的时候,代码已经进入了slideTo环节,其实清理_LSN.autoPlay已经没有用了。 slideTo执行到最后会自动创建新的计时器进入下一轮播放。

验证:
随便找个demo, 开启自动播放模式,因为duration默认是2000。就在初始化iSlider代码后面加上
```
setTimeout(()=>{
islider.pause()
}, 2000)
```
你会发现是暂停不了的。 (如果不能复现的话,可以改个延迟执行时间,多试试很容易重现)

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the pause() and slideTo() implementations referenced in the issue, then reproduce the behavior in any autoplay demo using the provided setTimeout example. Trace the autoplay timer through the slideTo transition and verify that calling pause() at that boundary leaves autoplay stopped and does not schedule another cycle.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.