Skip to content

Commit

Permalink
Add missing ConsoleLogProvider.razor.js file
Browse files Browse the repository at this point in the history
  • Loading branch information
dvoituron committed Dec 27, 2024
1 parent 4ce1a55 commit bad44e3
Showing 1 changed file with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
export function scrollToLastConsoleItem() {

const itemList = document.getElementById('console-items');

// Callback function to execute when mutations are observed
const observerCallback = (mutationsList, observer) => {
for (let mutation of mutationsList) {
if (mutation.type === 'childList') {
// Scroll to the bottom when a new item is added
itemList.scrollTop = itemList.scrollHeight;
}
}
};

// Create an instance of MutationObserver and pass in the callback function
const observer = new MutationObserver(observerCallback);

// Start observing the itemList for changes
observer.observe(itemList, { childList: true });
}

0 comments on commit bad44e3

Please sign in to comment.