MCPcopy Create free account
hub / github.com/GoogleChrome/samples / logMessage

Function logMessage

file-system-observer/observer.js:1–16  ·  view source on GitHub ↗
(message)

Source from the content-addressed store, hash-verified

1function logMessage(message) {
2 const logContainer = document.getElementById('observer');
3 const logEntry = document.createElement('div');
4 logEntry.className = 'log-entry';
5 logEntry.textContent = message;
6
7 logContainer.appendChild(logEntry);
8
9 // Ensure we only keep the last 10 log entries
10 while (logContainer.children.length > 10) {
11 logContainer.removeChild(logContainer.firstChild);
12 }
13
14 // Scroll to the bottom of the log
15 logContainer.scrollTop = logContainer.scrollHeight;
16}
17
18const callback = async (records, observer) => {
19 const icons = {

Callers 1

callbackFunction · 0.70

Calls 1

createElementMethod · 0.80

Tested by

no test coverage detected