mirror of https://github.com/espruino/BangleApps
Add generic intent "TRIGGER" whenever a trigger is send.
parent
70fbd194f1
commit
33dc0c566d
|
@ -38,8 +38,11 @@ The following icons are currently supported:
|
||||||
|
|
||||||
3.) Don't forget to select the action that should be executed at the bottom of each automation.
|
3.) Don't forget to select the action that should be executed at the bottom of each automation.
|
||||||
|
|
||||||
*Note: There is also an automatic trigger send when the app is started (APP_STARTED) -- so you could
|
# Default Trigger
|
||||||
add an action also for that.*
|
This app also implements two default trigger that can always be used:
|
||||||
|
- APP_STARTED -- Will be sent whenever the app is started. So you could do some actions already when the app is sarted without the need of any user interaction.
|
||||||
|
- TRIGGER -- Will be sent whenever some trigger is executed. So you could generically listen to that.
|
||||||
|
|
||||||
|
|
||||||
# FAQ
|
# FAQ
|
||||||
|
|
||||||
|
|
|
@ -101,15 +101,22 @@ Bangle.on('touch', function(btn, e){
|
||||||
Bangle.buzz(40, 0.6);
|
Bangle.buzz(40, 0.6);
|
||||||
position += 1;
|
position += 1;
|
||||||
position = position >= triggers.length ? 0 : position;
|
position = position >= triggers.length ? 0 : position;
|
||||||
|
draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isLeft){
|
if(isLeft){
|
||||||
Bangle.buzz(40, 0.6);
|
Bangle.buzz(40, 0.6);
|
||||||
position -= 1;
|
position -= 1;
|
||||||
position = position < 0 ? triggers.length-1 : position;
|
position = position < 0 ? triggers.length-1 : position;
|
||||||
|
draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!isRight && !isLeft){
|
if(!isRight && !isLeft){
|
||||||
|
|
||||||
|
// Send a default intent that we triggered something.
|
||||||
|
sendIntent("TRIGGER");
|
||||||
|
|
||||||
|
// Now send the selected trigger
|
||||||
Bangle.buzz(80, 0.6).then(()=>{
|
Bangle.buzz(80, 0.6).then(()=>{
|
||||||
sendIntent(triggers[position].trigger);
|
sendIntent(triggers[position].trigger);
|
||||||
setTimeout(()=>{
|
setTimeout(()=>{
|
||||||
|
@ -117,8 +124,6 @@ Bangle.on('touch', function(btn, e){
|
||||||
}, 250);
|
}, 250);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
draw();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Send intent that the we started the app.
|
// Send intent that the we started the app.
|
||||||
|
|
Loading…
Reference in New Issue