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
+12
View File
@@ -1,3 +1,5 @@
import { isIOS as checkIsIOS } from '../validate/system';
type ScrollElement = HTMLElement | Window;
function isWindow(val: unknown): val is Window {
@@ -56,3 +58,13 @@ export function getVisibleTop(el: ScrollElement) {
}
return el.getBoundingClientRect().top;
}
const isIOS = checkIsIOS();
// hack for iOS12 page scroll
// see: https://developers.weixin.qq.com/community/develop/doc/00044ae90742f8c82fb78fcae56800
export function resetScroll() {
if (isIOS) {
setRootScrollTop(getRootScrollTop());
}
}