mirror of https://github.com/espruino/BangleApps
Implement log viewing in app loader
parent
df84f229e4
commit
e542bed0a0
|
@ -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>
|
|
@ -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}
|
||||
|
|
Loading…
Reference in New Issue