Implement log viewing in app loader

pull/3516/head
Travis Evans 2024-06-19 15:29:57 -05:00
parent df84f229e4
commit e542bed0a0
2 changed files with 32 additions and 0 deletions

View File

@ -0,0 +1,31 @@
<html>
<head>
<link rel="stylesheet" href="../../css/spectre.min.css">
</head>
<body>
<script src="../../core/lib/interface.js"></script>
<div id="content">Loading...</div>
<script>
function onInit() {
Util.readStorageJSON('timestamplog.json', stampLog => {
document.getElementById("content").innerHTML = HTMLStampLog(stampLog);
});
}
function HTMLStampLog(stampLog) {
html = ''
if (stampLog.length) {
html += '<ol>';
for (const logItem of stampLog) {
html += ('<li>' + new Date(logItem.stamp).toLocaleString() + '</li>');
}
html += '</ol>';
} else {
html += '(empty)';
}
console.log(html);
return html;
}
</script>
</body>
</html>

View File

@ -7,6 +7,7 @@
"description": "Conveniently record a series of date/time stamps",
"tags": "timestamp, log",
"supports": ["BANGLEJS2"],
"interface": "interface.html",
"storage": [
{"name": "timestamplog.app.js", "url": "app.js"},
{"name": "timestamplog.img", "url": "app-icon.js", "evaluate": true}