chore: expose utils in entry file

This commit is contained in:
chenjiahan
2020-09-27 17:11:43 +08:00
parent da0d5435de
commit 0072f4fe02
33 changed files with 120 additions and 105 deletions
+4 -5
View File
@@ -1,14 +1,13 @@
import { raf, cancelRaf } from '../utils/dom/raf';
import { getScrollTop, setScrollTop } from '../utils/dom/scroll';
import { raf, cancelRaf, getScrollTop, setScrollTop } from '../utils';
let scrollLeftRafId: number;
let rafId: number;
export function scrollLeftTo(
scroller: HTMLElement,
to: number,
duration: number
) {
cancelRaf(scrollLeftRafId);
cancelRaf(rafId);
let count = 0;
const from = scroller.scrollLeft;
@@ -18,7 +17,7 @@ export function scrollLeftTo(
scroller.scrollLeft += (to - from) / frames;
if (++count < frames) {
scrollLeftRafId = raf(animate);
rafId = raf(animate);
}
}