Merge pull request #2735 from hughbarney/master

RAM clock_info - a clock info that shows % ram used
pull/2737/head
Gordon Williams 2023-05-09 11:00:19 +01:00 committed by GitHub
commit a51c70eac9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 88 additions and 0 deletions

1
apps/clkinfom/ChangeLog Normal file
View File

@ -0,0 +1 @@
0.01: First version

11
apps/clkinfom/README.md Normal file
View File

@ -0,0 +1,11 @@
# RAM Clock Info
![](app.png)
A clock info that displays the % memory used
## Screenshots
![](screenshot.png)
Written by: [Hugh Barney](https://github.com/hughbarney) For support and discussion please post in the [Bangle JS Forum](http://forum.espruino.com/microcosms/1424/)

BIN
apps/clkinfom/app.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 206 B

61
apps/clkinfom/clkinfo.js Normal file
View File

@ -0,0 +1,61 @@
(function () {
var timeout;
var debug = function(o) {
//console.log(o);
};
var clearTimer = function() {
if (timeout) {
clearTimeout(timeout);
timeout = undefined;
debug("timer cleared");
}
};
var queueRedraw = function() {
clearTimer();
timeout = setTimeout(function() {
timeout = undefined;
queueRedraw();
}, 60000);
info.items[0].emit("redraw");
debug("queued");
};
var img = function() {
return atob("GBgBAAAAAAAAAAAAB//gD//wH//4HgB4HAA4HAA4HAA4HDw4HDw4HDw4HDw4HAA4HAA4HAA4HgB4H//4D//wB//gAAAAAAAAAAAA");
};
var text = function() {
var val = process.memory(false);
return '' + Math.round(val.usage*100 / val.total) + '%';
};
var info = {
name: "Bangle",
items: [
{
name: "ram",
get: function () { return ({
img: img(),
text: text()
}); },
run : function() {
debug("run");
queueRedraw();
},
show: function () {
debug("show");
this.run();
},
hide: function() {
debug("hide");
clearTimer();
}
}
]
};
return info;
});

View File

@ -0,0 +1,15 @@
{
"id": "clkinfom",
"name": "RAM Clock Info",
"version":"0.01",
"description": "Clockinfo that displays % used memory",
"icon": "app.png",
"screenshots": [{"url":"screenshot.png"}],
"type": "clkinfo",
"tags": "clkinfo",
"supports" : ["BANGLEJS2"],
"readme":"README.md",
"storage": [
{"name":"ram.clkinfo.js","url":"clkinfo.js"}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB