docs: fixed sidebar in API reference (#5871)

This commit is contained in:
Shahed Nasser
2023-12-14 13:26:24 +02:00
committed by GitHub
parent b5748ab59e
commit c0ce969cd7
13 changed files with 109 additions and 42 deletions
@@ -0,0 +1,8 @@
import { isElmWindow } from "./is-elm-window"
export function getScrolledTop(elm?: Element | Window): number {
if (!elm) {
return 0
}
return isElmWindow(elm) ? elm.scrollY : elm.scrollTop
}
+2
View File
@@ -3,4 +3,6 @@ export * from "./capitalize"
export * from "./check-sidebar-item-visibility"
export * from "./dom-utils"
export * from "./format-report-link"
export * from "./get-scrolled-top"
export * from "./is-elm-window"
export * from "./swr-fetcher"
@@ -0,0 +1,3 @@
export function isElmWindow(elm: unknown): elm is Window {
return typeof window !== "undefined" && elm === window
}