#31 : Code cleanup

This commit is contained in:
Vadim
2021-07-03 00:26:27 +03:00
parent 158a7489b2
commit e49556a301
2 changed files with 6 additions and 6 deletions

View File

@@ -174,6 +174,7 @@
} }
function applyAutoplay() { function applyAutoplay() {
console.log('autoplay', autoplay)
if (autoplay) { if (autoplay) {
autoplayDirectionFnDescription[autoplayDirection]() autoplayDirectionFnDescription[autoplayDirection]()
} }
@@ -186,7 +187,6 @@
await tick() await tick()
cleanupFns.push(store.subscribe(value => { cleanupFns.push(store.subscribe(value => {
currentPageIndex = value.currentPageIndex currentPageIndex = value.currentPageIndex
console.log('currentPageIndex', currentPageIndex)
})) }))
cleanupFns.push(() => progressManager.reset()) cleanupFns.push(() => progressManager.reset())
if (pagesElement && pageWindowElement) { if (pagesElement && pageWindowElement) {
@@ -215,13 +215,13 @@
} }
function offsetPage(animated) { function offsetPage(animated) {
_duration = animated ? duration : 0 // TODO: why not used _duration = animated ? duration : 0
offset = -currentPageIndex * pageWidth offset = -currentPageIndex * pageWidth
if (infinite) { if (infinite) {
if (currentPageIndex === 0) { if (currentPageIndex === 0) {
showPage(pagesCount - 2, { offsetDelayMs: duration, animated: false }) showPage(pagesCount - 2, { offsetDelayMs: _duration, animated: false })
} else if (currentPageIndex === pagesCount - 1) { } else if (currentPageIndex === pagesCount - 1) {
showPage(1, { offsetDelayMs: duration, animated: false }) showPage(1, { offsetDelayMs: _duration, animated: false })
} }
} }
} }
@@ -241,7 +241,7 @@
function showPage(pageIndex, options) { function showPage(pageIndex, options) {
const animated = get(options, 'animated', true) const animated = get(options, 'animated', true)
const offsetDelayMs = get(options, 'offsetDelayMs', true) // TODO: fix default value const offsetDelayMs = get(options, 'offsetDelayMs', 0)
safeChangePage(() => { safeChangePage(() => {
store.moveToPage({ pageIndex, pagesCount }) store.moveToPage({ pageIndex, pagesCount })
setTimeout(() => { setTimeout(() => {