mirror of https://github.com/espruino/BangleApps
counter2: fix lint warnings
parent
9c69827b48
commit
f6e972eb68
|
@ -1,2 +1,3 @@
|
|||
0.01: New App!
|
||||
0.02: Added Settings & readme
|
||||
0.03: fix lint warnings
|
||||
|
|
|
@ -9,23 +9,22 @@ var s = Object.assign({
|
|||
colortext: true,
|
||||
}, require('Storage').readJSON("counter2.json", true) || {});
|
||||
|
||||
f1 = (s.colortext) ? "#f00" : "#fff";
|
||||
f2 = (s.colortext) ? "#00f" : "#fff";
|
||||
b1 = (s.colortext) ? g.theme.bg : "#f00";
|
||||
b2 = (s.colortext) ? g.theme.bg : "#00f";
|
||||
const f1 = (s.colortext) ? "#f00" : "#fff";
|
||||
const f2 = (s.colortext) ? "#00f" : "#fff";
|
||||
const b1 = (s.colortext) ? g.theme.bg : "#f00";
|
||||
const b2 = (s.colortext) ? g.theme.bg : "#00f";
|
||||
|
||||
var counter = 0;
|
||||
var drag;
|
||||
|
||||
screenwidth = g.getWidth();
|
||||
screenheight = g.getHeight();
|
||||
halfwidth = screenwidth / 2;
|
||||
halfheight = screenheight / 2;
|
||||
const screenwidth = g.getWidth();
|
||||
const screenheight = g.getHeight();
|
||||
const halfwidth = screenwidth / 2;
|
||||
const halfheight = screenheight / 2;
|
||||
|
||||
counter = [];
|
||||
counter[0] = s.counter0;
|
||||
counter[1] = s.counter1;
|
||||
defaults = [];
|
||||
const defaults = [];
|
||||
defaults[0] = s.max0;
|
||||
defaults[1] = s.max1;
|
||||
|
||||
|
@ -37,7 +36,7 @@ function saveSettings() {
|
|||
require('Storage').writeJSON("counter2.json", s);
|
||||
}
|
||||
|
||||
ignoreonce = false;
|
||||
let ignoreonce = false;
|
||||
var dragtimeout;
|
||||
|
||||
function updateScreen() {
|
||||
|
@ -56,7 +55,7 @@ function updateScreen() {
|
|||
}
|
||||
|
||||
Bangle.on("drag", e => {
|
||||
c = (e.x < halfwidth) ? 0 : 1;
|
||||
const c = (e.x < halfwidth) ? 0 : 1;
|
||||
if (!drag) {
|
||||
if (ignoreonce) {
|
||||
ignoreonce = false;
|
||||
|
@ -66,7 +65,7 @@ Bangle.on("drag", e => {
|
|||
dragtimeout = setTimeout(function () { resetcounter(c); }, 600); //if dragging for 500ms, reset counter
|
||||
}
|
||||
else if (drag && !e.b) { // released
|
||||
adjust = 0;
|
||||
let adjust = 0;
|
||||
const dx = e.x - drag.x, dy = e.y - drag.y;
|
||||
if (Math.abs(dy) > Math.abs(dx) + 30) {
|
||||
adjust = (dy > 0) ? -1 : 1;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"id": "counter2",
|
||||
"name": "Counter2",
|
||||
"version": "0.02",
|
||||
"version": "0.03",
|
||||
"description": "Dual Counter",
|
||||
"readme":"README.md",
|
||||
"icon": "counter2-icon.png",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
(function (back) {
|
||||
var FILE = "counter2.json";
|
||||
defaults={
|
||||
const defaults={
|
||||
counter0:12,
|
||||
counter1:0,
|
||||
max0:12,
|
||||
|
@ -8,13 +8,13 @@
|
|||
buzz: true,
|
||||
colortext: true,
|
||||
};
|
||||
settings = Object.assign(defaults, require('Storage').readJSON(FILE, true) || {});
|
||||
const settings = Object.assign(defaults, require('Storage').readJSON(FILE, true) || {});
|
||||
|
||||
function writeSettings() {
|
||||
require('Storage').writeJSON(FILE, settings);
|
||||
}
|
||||
|
||||
menu = {
|
||||
const menu = {
|
||||
"": { "title": "Counter2" },
|
||||
"< Back": () => back(),
|
||||
'Default C1': {
|
||||
|
|
Loading…
Reference in New Issue