mirror of https://github.com/espruino/BangleApps
Merge pull request #2735 from hughbarney/master
RAM clock_info - a clock info that shows % ram usedpull/2737/head
commit
a51c70eac9
|
@ -0,0 +1 @@
|
|||
0.01: First version
|
|
@ -0,0 +1,11 @@
|
|||
# RAM Clock Info
|
||||
|
||||

|
||||
|
||||
A clock info that displays the % memory used
|
||||
|
||||
## Screenshots
|
||||
|
||||

|
||||
|
||||
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/)
|
Binary file not shown.
After Width: | Height: | Size: 206 B |
|
@ -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;
|
||||
});
|
|
@ -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 |
Loading…
Reference in New Issue