1
0
mirror of https://gitee.com/coder-xiaomo/algorithm-visualization synced 2025-09-10 06:31:37 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee

添加ConsoleClear方法

This commit is contained in:
2022-05-18 19:30:15 +08:00
parent 1d0c253db4
commit e3f47b5bc3
3 changed files with 34 additions and 11 deletions

View File

@@ -88,16 +88,21 @@ initialize()
// 临时输出
function consoleLog(data) {
console.log(data)
let consoleList = settings.console.consoleList
consoleList.push(data)
if (consoleList.length > settings.console.maxLine + 1) {
consoleList.shift()
consoleList[0] = "<small>更早的记录已经被丢掉啦</small>"
if (data) {
consoleList.push(data)
if (consoleList.length > settings.console.maxLine + 1) {
consoleList.shift()
consoleList[0] = "<small>更早的记录已经被丢掉啦</small>"
}
}
let container = document.getElementById("console-logs")
container.innerHTML = consoleList.join("<br>")
container.scrollTop = container.scrollHeight
let consoleContainer = document.getElementById("console-logs")
consoleContainer.innerHTML = consoleList.join("<br>")
consoleContainer.scrollTop = container.scrollHeight
}
function consoleClear() {
settings.console.consoleList = []
consoleLog()
}
function displayCurrentArray(array) {