@snap-carousel/core
Advanced tools
Comparing version 0.0.19-next.2 to 0.0.19-next.3
@@ -6,2 +6,3 @@ export declare const getActiveSnap: ({ root, onChange, }: { | ||
destroy: () => void; | ||
getActiveIndex: () => number; | ||
}; |
@@ -77,3 +77,3 @@ const mergeStyles = (...classnames) => classnames.filter(Boolean).join(' '); | ||
let activeSnapObserver; | ||
let activeSnapIndex; | ||
let activeSnapIndex = 0; | ||
let timeout = null; | ||
@@ -210,2 +210,5 @@ const children = root.children; | ||
destroy, | ||
getActiveIndex: () => { | ||
return activeSnapIndex; | ||
}, | ||
}; | ||
@@ -212,0 +215,0 @@ }; |
@@ -81,3 +81,3 @@ 'use strict'; | ||
let activeSnapObserver; | ||
let activeSnapIndex; | ||
let activeSnapIndex = 0; | ||
let timeout = null; | ||
@@ -214,2 +214,5 @@ const children = root.children; | ||
destroy, | ||
getActiveIndex: () => { | ||
return activeSnapIndex; | ||
}, | ||
}; | ||
@@ -216,0 +219,0 @@ }; |
{ | ||
"name": "@snap-carousel/core", | ||
"version": "0.0.19-next.2", | ||
"version": "0.0.19-next.3", | ||
"main": "dist/index.js", | ||
@@ -26,3 +26,3 @@ "module": "dist/index.es.js", | ||
}, | ||
"gitHead": "abc79363e32b599cae386d24c200009286d347b5" | ||
"gitHead": "75a4d82274006163d034d4329c22960283022342" | ||
} |
@@ -11,5 +11,4 @@ import { debounceHOF } from './utils'; | ||
let activeSnapObserver: IntersectionObserver; | ||
let activeSnapIndex: number; | ||
let activeSnapIndex = 0; | ||
let timeout: number | null = null; | ||
let isScrolling = false; | ||
@@ -34,3 +33,2 @@ const children = root.children; | ||
activeSnapIndex = snapIndex; | ||
triggerChange(snapIndex); | ||
@@ -47,7 +45,5 @@ }; | ||
const handleScrolling = () => { | ||
isScrolling = true; | ||
if (timeout) clearTimeout(timeout); | ||
timeout = setTimeout(() => { | ||
isScrolling = false; | ||
if (root.scrollLeft === 0) { | ||
@@ -213,3 +209,6 @@ setSnapIndex(0); | ||
destroy, | ||
getActiveIndex: () => { | ||
return activeSnapIndex; | ||
}, | ||
}; | ||
}; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
149778
1858