Files
nextcloud/php/public/scroll-into-view.js
Pablo Zmdl b0ab901b31 As heartbeat send a dot regularly
Rather than repeating the message, send a "magic" dot, which gets
appended to the previous line.

Previously the heartbeats weren't sent regulary because reading the data
into a buffer caused a lag.

Signed-off-by: Pablo Zmdl <pablo@nextcloud.com>
2026-05-21 13:24:04 +02:00

14 lines
526 B
JavaScript

const observer = new MutationObserver((records) => {
const node = records[0]?.addedNodes[0];
// Text nodes also appear here but can't be scrolled to, so we have to check for the
// function being present.
if (node && typeof(node.scrollIntoView) === 'function') {
node.scrollIntoView();
if (node.classList.contains('progress-indicator')) {
node.previousSibling.append('.');
node.remove();
}
}
});
observer.observe(document, {childList: true, subtree: true});