MCPcopy
hub / github.com/handsontable/handsontable / scrollViewportVertically

Function scrollViewportVertically

handsontable/test/helpers/common.js:685–703  ·  view source on GitHub ↗
(y)

Source from the content-addressed store, hash-verified

683 * @param {number} y The scroll position.
684 */
685export async function scrollViewportVertically(y) {
686 const isWindow = hot().view._wt.wtOverlays.scrollableElement === hot().rootWindow;
687 const scrollableElement = isWindow ? window : getMaster().find('.wtHolder')[0];
688
689 return new Promise((resolve) => {
690 const scrollHandler = () => {
691 scrollableElement.removeEventListener('scroll', scrollHandler);
692 resolve();
693 };
694
695 scrollableElement.addEventListener('scroll', scrollHandler);
696
697 if (isWindow) {
698 scrollableElement.scrollTo(scrollableElement.scrollX, y);
699 } else {
700 scrollableElement.scrollTop = y;
701 }
702 });
703}
704
705/**
706 * Moves the table's viewport to the specified x scroll position.

Callers

nothing calls this directly

Calls 4

getMasterFunction · 0.85
addEventListenerMethod · 0.80
hotFunction · 0.70
scrollToMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…