1
0
mirror of https://github.com/trezor/trezor-wallet synced 2025-07-01 20:32:37 +00:00
trezor-wallet/src/utils/windowUtils.js
2018-08-27 17:15:22 +02:00

17 lines
525 B
JavaScript

/* @flow */
export const getViewportHeight = (): number => (
// $FlowIssue
window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight // $FlowIssue
);
export const getScrollY = (): number => {
if (window.pageYOffset !== undefined) {
return window.pageYOffset;
} if (window.scrollTop !== undefined) {
return window.scrollTop;
}
// $FlowIssue
return (document.documentElement || document.body.parentNode || document.body).scrollTop; // $FlowIssue
};