mirror of https://github.com/espruino/BangleApps
Merge pull request #2138 from splch/work_hours
Twenties - vibrates during work hourspull/2143/head^2
commit
75066fae86
|
@ -1,2 +1,3 @@
|
|||
0.01: New Widget!
|
||||
0.02: Fix calling null on draw
|
||||
0.03: Only vibrate during work
|
|
@ -2,7 +2,7 @@
|
|||
"id": "widtwenties",
|
||||
"name": "Twenties",
|
||||
"shortName": "twenties",
|
||||
"version": "0.02",
|
||||
"version": "0.03",
|
||||
"description": "Buzzes every 20m to stand / sit and look 20ft away for 20s.",
|
||||
"icon": "widget.png",
|
||||
"type": "widget",
|
||||
|
|
|
@ -7,9 +7,15 @@ they don't interfere with currently-running apps */
|
|||
const look = 20 * 1000; // 20 seconds
|
||||
|
||||
buzz = _ => {
|
||||
const date = new Date();
|
||||
const day = date.getDay();
|
||||
const hour = date.getHours();
|
||||
// buzz at work
|
||||
if (day <= 5 && hour >= 8 && hour <= 17) {
|
||||
Bangle.buzz().then(_ => {
|
||||
setTimeout(Bangle.buzz, look);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
// add widget
|
||||
|
|
Loading…
Reference in New Issue