Skip to content

Commit

Permalink
debug frame: Limit the messages element in size
Browse files Browse the repository at this point in the history
Signed-off-by: Hubert Figuière <[email protected]>
Change-Id: I1f43d4839341e9d1acac617cc6a6a96e2118a51f
  • Loading branch information
hfiguiere authored and eszkadev committed Dec 6, 2024
1 parent a4d480a commit 3abb4ec
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions browser/html/framed.doc.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,16 @@
margin: 0px;
}

#messages {
height: 5vh;
overflow: scroll;
}

#messages > p {
margin: 0;
font-family: monospace;
}

</style>

<script>
Expand Down Expand Up @@ -290,6 +300,13 @@
display.querySelector("#UserState_Elapsed").textContent = msg.Values.Elapsed;
}

function ClearMessages() {
let messageOut = document.getElementById("messages");
while (child = messageOut.firstChild) {

Check warning

Code scanning / CodeQL

Missing variable declaration Warning

Variable child is used like a local variable, but is missing a declaration.
child.remove();
}
}

// This function is invoked when the iframe posts a message back.

function receiveMessage(event) {
Expand All @@ -300,7 +317,9 @@
}

let messageOut = document.getElementById("messages");
messageOut.textContent = messageOut.textContent + JSON.stringify(msg) + "\n";
let line = document.createElement("p");
line.textContent = JSON.stringify(msg);
messageOut.append(line);

if (msg.MessageId == 'App_LoadingStatus') {
if (msg.Values) {
Expand Down Expand Up @@ -588,9 +607,9 @@ <h3>Send a message</h3>

<div class="framed hbox">
<div class="vbox">
<h3>Messages from editor</h3>
<h3>Messages from editor <button onclick="ClearMessages();">Clear</button></h3>

<pre id="messages"></pre>
<div id="messages"></div>
</div>
</div>

Expand Down

0 comments on commit 3abb4ec

Please sign in to comment.