From d942e834c58b3291425038325ab5ff009fb5d87d Mon Sep 17 00:00:00 2001 From: Vladimir Kharlampidi Date: Wed, 1 Jun 2022 12:34:03 +0300 Subject: [PATCH] Revert "fix(autoplay): immediate proceed autoplay when `autoplay.delay = 0`" This reverts commit 81a4cc83064c5e49a831afedf67251e754986c75. --- src/modules/autoplay/autoplay.js | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/modules/autoplay/autoplay.js b/src/modules/autoplay/autoplay.js index cb6609dd9..94264a5aa 100644 --- a/src/modules/autoplay/autoplay.js +++ b/src/modules/autoplay/autoplay.js @@ -29,8 +29,8 @@ export default function Autoplay({ swiper, extendParams, on, emit }) { if ($activeSlideEl.attr('data-swiper-autoplay')) { delay = $activeSlideEl.attr('data-swiper-autoplay') || swiper.params.autoplay.delay; } - - const proceed = () => { + clearTimeout(timeout); + timeout = nextTick(() => { let autoplayResult; if (swiper.params.autoplay.reverseDirection) { if (swiper.params.loop) { @@ -68,14 +68,6 @@ export default function Autoplay({ swiper, extendParams, on, emit }) { else if (autoplayResult === false) { run(); } - }; - clearTimeout(timeout); - if (delay === 0) { - proceed(); - return; - } - timeout = nextTick(() => { - proceed(); }, delay); } function start() {