tileclk: Convert nearly all functions to arrow syntax for memory savings

master
stweedo 2025-06-19 08:00:55 -05:00
parent efbe79b51d
commit e4aa9ed930
2 changed files with 1077 additions and 1077 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,80 +1,80 @@
(function(back){ (function(back){
let appSettings = Object.assign({ let appSettings = Object.assign({
widgets: "show", widgets: "show",
seconds: "hide", seconds: "hide",
borders: true, borders: true,
borderColor: "theme", borderColor: "theme",
haptics: true haptics: true
}, require("Storage").readJSON("tileclk.json", true) || {}); }, require("Storage").readJSON("tileclk.json", true) || {});
function writeSettings() { const writeSettings = () => {
require("Storage").writeJSON("tileclk.json", appSettings); require("Storage").writeJSON("tileclk.json", appSettings);
} }
const colorOptions = { const colorOptions = {
"Theme (bgH)": "theme", "Theme (bgH)": "theme",
"Black": "#000000", "Black": "#000000",
"White": "#FFFFFF", "White": "#FFFFFF",
"Dark Gray": "#404040", "Dark Gray": "#404040",
"Light Gray": "#808080", "Light Gray": "#808080",
"Red": "#FF0000", "Red": "#FF0000",
"Green": "#00FF00", "Green": "#00FF00",
"Blue": "#0000FF", "Blue": "#0000FF",
"Cyan": "#00FFFF", "Cyan": "#00FFFF",
"Magenta": "#FF00FF", "Magenta": "#FF00FF",
"Yellow": "#FFFF00" "Yellow": "#FFFF00"
}; };
function showMenu() { const showMenu = () => {
E.showMenu({ E.showMenu({
"": { "title": "Tile Clock" }, "": { "title": "Tile Clock" },
"< Back": () => back(), "< Back": () => back(),
"Widgets:": { "Widgets:": {
value: appSettings.widgets === "show" ? 0 : appSettings.widgets === "hide" ? 1 : 2, value: appSettings.widgets === "show" ? 0 : appSettings.widgets === "hide" ? 1 : 2,
min: 0, min: 0,
max: 2, max: 2,
onchange: v => { onchange: v => {
appSettings.widgets = ["show", "hide", "swipe"][v]; appSettings.widgets = ["show", "hide", "swipe"][v];
writeSettings(); writeSettings();
}, },
format: v => ["Show", "Hide", "Swipe"][v] format: v => ["Show", "Hide", "Swipe"][v]
}, },
"Seconds:": { "Seconds:": {
value: appSettings.seconds === "show" ? 0 : appSettings.seconds === "hide" ? 1 : 2, value: appSettings.seconds === "show" ? 0 : appSettings.seconds === "hide" ? 1 : 2,
min: 0, min: 0,
max: 2, max: 2,
onchange: v => { onchange: v => {
appSettings.seconds = ["show", "hide", "dynamic"][v]; appSettings.seconds = ["show", "hide", "dynamic"][v];
writeSettings(); writeSettings();
}, },
format: v => ["Show", "Hide", "Dynamic"][v] format: v => ["Show", "Hide", "Dynamic"][v]
}, },
"Tile Borders:": { "Tile Borders:": {
value: appSettings.borders === false ? false : true, value: appSettings.borders === false ? false : true,
onchange: v => { onchange: v => {
appSettings.borders = v; appSettings.borders = v;
writeSettings(); writeSettings();
} }
}, },
"Border Color": { "Border Color": {
value: Object.values(colorOptions).indexOf(appSettings.borderColor || "theme"), value: Object.values(colorOptions).indexOf(appSettings.borderColor || "theme"),
min: 0, min: 0,
max: Object.keys(colorOptions).length - 1, max: Object.keys(colorOptions).length - 1,
onchange: v => { onchange: v => {
appSettings.borderColor = Object.values(colorOptions)[v]; appSettings.borderColor = Object.values(colorOptions)[v];
writeSettings(); writeSettings();
}, },
format: v => Object.keys(colorOptions)[v] format: v => Object.keys(colorOptions)[v]
}, },
"Haptic Feedback:": { "Haptic Feedback:": {
value: appSettings.haptics !== false, value: appSettings.haptics !== false,
onchange: v => { onchange: v => {
appSettings.haptics = v; appSettings.haptics = v;
writeSettings(); writeSettings();
} }
} }
}); });
} }
showMenu(); showMenu();
}) })