msgtwscr: fix function used before declared

master
thyttan 2025-06-24 11:23:09 +02:00 committed by GitHub
parent 7608697377
commit fb9c4173ff
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 24 additions and 23 deletions

View File

@ -1,27 +1,4 @@
{
// If doing regular loads, not Bangle.load, this is used:
if (global.__FILE__=="messagegui.new.js") {
onTwistEmitDrag();
}
let attachAfterTimeout = ()=>{
setTimeout(()=>{
if (global.__FILE__=="messagegui.new.js") {
onTwistEmitDrag();
}
},700)
// It feels like there's a more elegant solution than checking the filename
// after 700 milliseconds. But this at least seems to work w/o sometimes
// activating when it shouldn't.
// Maybe we could add events for when fast load and/or Bangle.uiRemove occurs?
// Then that could be used similarly to boot code and/or the `kill` event.
}
// If Fastload Utils is installed this is used:
Bangle.on("message", (_, msg)=>{if (Bangle.CLOCK && msg.new) {
attachAfterTimeout();
}});
// twistThreshold How much acceleration to register a twist of the watch strap? Can be negative for opposite direction. default = 800
// twistMaxY Maximum acceleration in Y to trigger a twist (low Y means watch is facing the right way up). default = -800
// twistTimeout How little time (in ms) must a twist take from low->high acceleration? default = 1000
@ -59,4 +36,28 @@
}},
800)
}
// If doing regular loads, not Bangle.load, this is used:
if (global.__FILE__=="messagegui.new.js") {
onTwistEmitDrag();
}
let attachAfterTimeout = ()=>{
setTimeout(()=>{
if (global.__FILE__=="messagegui.new.js") {
onTwistEmitDrag();
}
},700)
// It feels like there's a more elegant solution than checking the filename
// after 700 milliseconds. But this at least seems to work w/o sometimes
// activating when it shouldn't.
// Maybe we could add events for when fast load and/or Bangle.uiRemove occurs?
// Then that could be used similarly to boot code and/or the `kill` event.
}
// If Fastload Utils is installed this is used:
Bangle.on("message", (_, msg)=>{if (Bangle.CLOCK && msg.new) {
attachAfterTimeout();
}});
}