Skip to content

Commit 63797c4

Browse files
committed
[gbmusic] fix lint warnings
1 parent bce6a07 commit 63797c4

File tree

2 files changed

+62
-58
lines changed

2 files changed

+62
-58
lines changed

apps/gbmusic/app.js

Lines changed: 56 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -128,57 +128,60 @@ function rInfo(l) {
128128
.setFontAlign(0, -1) // center top
129129
.drawString(l.label, l.x+l.w/2, l.y);
130130
}
131-
/**
132-
* Render icon
133-
* @param l
134-
*/
135-
function rIcon(l) {
136-
const x2 = l.x+l.w-1,
137-
y2 = l.y+l.h-1;
138-
switch(l.icon) {
139-
case "pause": {
140-
const w13 = l.w/3;
141-
g.drawRect(l.x, l.y, l.x+w13, y2);
142-
g.drawRect(l.x+l.w-w13, l.y, x2, y2);
143-
break;
144-
}
145-
case "play": {
146-
g.drawPoly([
147-
l.x, l.y,
148-
x2, l.y+l.h/2,
149-
l.x, y2,
150-
], true);
151-
break;
152-
}
153-
case "previous": {
154-
const w15 = l.w*1/5;
155-
g.drawPoly([
156-
x2, l.y,
157-
l.x+w15, l.y+l.h/2,
158-
x2, y2,
159-
], true);
160-
g.drawRect(l.x, l.y, l.x+w15, y2);
161-
break;
162-
}
163-
case "next": {
164-
const w45 = l.w*4/5;
165-
g.drawPoly([
166-
l.x, l.y,
167-
l.x+w45, l.y+l.h/2,
168-
l.x, y2,
169-
], true);
170-
g.drawRect(l.x+w45, l.y, x2, y2);
171-
break;
172-
}
173-
default: { // red X
174-
console.log(`Unknown icon: ${l.icon}`);
175-
g.setColor("#f00")
176-
.drawRect(l.x, l.y, x2, y2)
177-
.drawLine(l.x, l.y, x2, y2)
178-
.drawLine(l.x, y2, x2, l.y);
179-
}
180-
}
181-
}
131+
132+
// *** Unused Function ***
133+
// // /**
134+
// // * Render icon
135+
// // * @param l
136+
// // */
137+
// // function rIcon(l) {
138+
// // const x2 = l.x+l.w-1,
139+
// // y2 = l.y+l.h-1;
140+
// // switch(l.icon) {
141+
// // case "pause": {
142+
// // const w13 = l.w/3;
143+
// // g.drawRect(l.x, l.y, l.x+w13, y2);
144+
// // g.drawRect(l.x+l.w-w13, l.y, x2, y2);
145+
// // break;
146+
// // }
147+
// // case "play": {
148+
// // g.drawPoly([
149+
// // l.x, l.y,
150+
// // x2, l.y+l.h/2,
151+
// // l.x, y2,
152+
// // ], true);
153+
// // break;
154+
// // }
155+
// // case "previous": {
156+
// // const w15 = l.w*1/5;
157+
// // g.drawPoly([
158+
// // x2, l.y,
159+
// // l.x+w15, l.y+l.h/2,
160+
// // x2, y2,
161+
// // ], true);
162+
// // g.drawRect(l.x, l.y, l.x+w15, y2);
163+
// // break;
164+
// // }
165+
// // case "next": {
166+
// // const w45 = l.w*4/5;
167+
// // g.drawPoly([
168+
// // l.x, l.y,
169+
// // l.x+w45, l.y+l.h/2,
170+
// // l.x, y2,
171+
// // ], true);
172+
// // g.drawRect(l.x+w45, l.y, x2, y2);
173+
// // break;
174+
// // }
175+
// // default: { // red X
176+
// // console.log(`Unknown icon: ${l.icon}`);
177+
// // g.setColor("#f00")
178+
// // .drawRect(l.x, l.y, x2, y2)
179+
// // .drawLine(l.x, l.y, x2, y2)
180+
// // .drawLine(l.x, y2, x2, l.y);
181+
// // }
182+
// // }
183+
// // }
184+
182185
let layout;
183186
function makeUI() {
184187
Bangle.loadWidgets();
@@ -489,10 +492,10 @@ function startLCDWatch() {
489492
Bangle.on("lcdPower", (on) => {
490493
if (on) {
491494
// redraw and resume scrolling
492-
tick();
495+
//tick(); // Not sure what this function was; currently undefined
493496
layout.render();
494497
fadeOut();
495-
if (offset.offset!==null) {
498+
if (layout.title.offset!==null) { // Making an assumption about what offset.offset was supposed to be
496499
if (!iScroll) {
497500
iScroll = setInterval(scroll, 200);
498501
}

apps/gbmusic/boot.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
setTimeout( // make other boot code run first, so we override e.g. android.boot.js GB
22
() => {
3-
const APP = global.__FILE__==="gbmusic.app.js",
3+
const APP = globalThis.__FILE__==="gbmusic.app.js",
44
a = !!(require("Storage").readJSON("gbmusic.json", 1) || {}).autoStart;
55

66
let s, i; // state, info
@@ -20,18 +20,19 @@ setTimeout( // make other boot code run first, so we override e.g. android.boot.
2020
load("gbmusic.app.js");
2121
}
2222

23-
global.GB = (_GB => e => {
23+
24+
globalThis.GB = (_GB => e => {
2425
// we eat music events!
2526
switch(e.t) {
2627
case "musicinfo":
2728
i = e;
28-
return APP ? info(e) : check();
29+
return APP ? globalThis.info(e) : check();
2930
case "musicstate":
3031
s = e;
31-
return APP ? state(e) : check();
32+
return APP ? globalThis.state(e) : check();
3233
default:
3334
// pass on other events
3435
if (_GB) setTimeout(_GB, 0, e);
3536
}
36-
})(global.GB);
37+
})(globalThis.GB);
3738
}, 1);

0 commit comments

Comments
 (0)