UNPKG

web-collect-events-narayana

Version:

An sdk for collecting events from web pages

25 lines (24 loc) 955 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); function getScrollState() { const scrollState = {}; // Retrieve scroll-related information scrollState.scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop; scrollState.scrollLeft = window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft; scrollState.scrollHeight = document.documentElement.scrollHeight || document.body.scrollHeight; scrollState.scrollWidth = document.documentElement.scrollWidth || document.body.scrollWidth; scrollState.clientHeight = document.documentElement.clientHeight || document.body.clientHeight; scrollState.clientWidth = document.documentElement.clientWidth || document.body.clientWidth; return scrollState; } exports.default = getScrollState;