Merge pull request #2046 from rigrig/clockface-powersave

Clockface: powersaving
master
Gordon Williams 2022-07-15 08:16:38 +01:00 committed by GitHub
commit 43b2a0b55c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 2 deletions

View File

@ -49,6 +49,7 @@ function ClockFace(options) {
}
ClockFace.prototype.tick = function() {
"ram"
const time = new Date();
const now = {
d: `${time.getFullYear()}-${time.getMonth()}-${time.getDate()}`,

View File

@ -208,7 +208,7 @@ let menu = {
/*LANG*/"< Back": back,
};
require("ClockFace_menu").addSettingsFile(menu, "<appid>.settings.json", [
"showDate", "loadWidgets"
"showDate", "loadWidgets", "powerSave",
]);
E.showMenu(menu);

View File

@ -11,12 +11,16 @@ exports.addItems = function(menu, callback, items) {
const label = {
showDate:/*LANG*/"Show date",
loadWidgets:/*LANG*/"Load widgets",
powerSave:/*LANG*/"Power saving",
}[key];
switch(key) {
// boolean options which default to true
case "showDate":
case "loadWidgets":
// boolean options, which default to true
if (value===undefined) value = true;
// fall through
case "powerSave":
// same for all boolean options:
menu[label] = {
value: !!value,
onchange: v => callback(key, v),