save window stats on all close types

This commit is contained in:
Andrew Gundersen 2021-03-20 12:33:55 -05:00
commit e7fd5a0bfa
5 changed files with 54 additions and 32 deletions

View file

@ -4,6 +4,18 @@ export default function useScroll(element: string) {
let isScrolledToBottom: boolean;
// Set the initial scroll position.
const setScroll = () => {
const view = document.getElementById(element)
if (view) {
view.scrollTo({
top: view.scrollHeight - view.clientHeight,
behavior: 'smooth'
});
}
}
// Update isScrolledToBottom
const updateScrollRef = () => {
const view = document.getElementById(element)
@ -31,7 +43,8 @@ export default function useScroll(element: string) {
return {
updateScrollRef,
adjustScroll
adjustScroll,
setScroll,
}
}