Skip to content

Commit fb9c417

Browse files
authored
msgtwscr: fix function used before declared
1 parent 7608697 commit fb9c417

File tree

1 file changed

+24
-23
lines changed

1 file changed

+24
-23
lines changed

apps/msgtwscr/boot.js

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,4 @@
11
{
2-
// If doing regular loads, not Bangle.load, this is used:
3-
if (global.__FILE__=="messagegui.new.js") {
4-
onTwistEmitDrag();
5-
}
6-
7-
let attachAfterTimeout = ()=>{
8-
setTimeout(()=>{
9-
if (global.__FILE__=="messagegui.new.js") {
10-
onTwistEmitDrag();
11-
}
12-
},700)
13-
// It feels like there's a more elegant solution than checking the filename
14-
// after 700 milliseconds. But this at least seems to work w/o sometimes
15-
// activating when it shouldn't.
16-
// Maybe we could add events for when fast load and/or Bangle.uiRemove occurs?
17-
// Then that could be used similarly to boot code and/or the `kill` event.
18-
}
19-
20-
// If Fastload Utils is installed this is used:
21-
Bangle.on("message", (_, msg)=>{if (Bangle.CLOCK && msg.new) {
22-
attachAfterTimeout();
23-
}});
24-
252
// twistThreshold How much acceleration to register a twist of the watch strap? Can be negative for opposite direction. default = 800
263
// twistMaxY Maximum acceleration in Y to trigger a twist (low Y means watch is facing the right way up). default = -800
274
// twistTimeout How little time (in ms) must a twist take from low->high acceleration? default = 1000
@@ -59,4 +36,28 @@
5936
}},
6037
800)
6138
}
39+
40+
// If doing regular loads, not Bangle.load, this is used:
41+
if (global.__FILE__=="messagegui.new.js") {
42+
onTwistEmitDrag();
43+
}
44+
45+
let attachAfterTimeout = ()=>{
46+
setTimeout(()=>{
47+
if (global.__FILE__=="messagegui.new.js") {
48+
onTwistEmitDrag();
49+
}
50+
},700)
51+
// It feels like there's a more elegant solution than checking the filename
52+
// after 700 milliseconds. But this at least seems to work w/o sometimes
53+
// activating when it shouldn't.
54+
// Maybe we could add events for when fast load and/or Bangle.uiRemove occurs?
55+
// Then that could be used similarly to boot code and/or the `kill` event.
56+
}
57+
58+
// If Fastload Utils is installed this is used:
59+
Bangle.on("message", (_, msg)=>{if (Bangle.CLOCK && msg.new) {
60+
attachAfterTimeout();
61+
}});
62+
6263
}

0 commit comments

Comments
 (0)