diff --git a/apps/widtwenties/ChangeLog b/apps/widtwenties/ChangeLog new file mode 100644 index 000000000..4c21f3ace --- /dev/null +++ b/apps/widtwenties/ChangeLog @@ -0,0 +1 @@ +0.01: New Widget! diff --git a/apps/widtwenties/README.md b/apps/widtwenties/README.md new file mode 100644 index 000000000..e4f679989 --- /dev/null +++ b/apps/widtwenties/README.md @@ -0,0 +1,15 @@ +# Twenties + +Follow the [20-20-20 rule](https://www.aoa.org/AOA/Images/Patients/Eye%20Conditions/20-20-20-rule.pdf) with discrete reminders. Your BangleJS will buzz every 20 minutes for you to look away from your screen, and then buzz 20 seconds later to look back. Additionally, alternate between standing and sitting every 20 minutes to be standing for [more than 30 minutes](https://uwaterloo.ca/kinesiology-health-sciences/how-long-should-you-stand-rather-sit-your-work-station) per hour. + +## Usage + +Download this widget and as long as your watch-face supports widgets, it will automatically run in the background. + +## Features + +Vibrate to remind you to stand up and look away for healthy living. + +## Creator + +@splch diff --git a/apps/widtwenties/metadata.json b/apps/widtwenties/metadata.json new file mode 100644 index 000000000..ebc393a47 --- /dev/null +++ b/apps/widtwenties/metadata.json @@ -0,0 +1,13 @@ +{ + "id": "widtwenties", + "name": "Twenties", + "shortName": "twenties", + "version": "0.01", + "description": "Buzzes every 20m to stand / sit and look 20ft away for 20s.", + "icon": "widget.png", + "type": "widget", + "tags": "widget,tools", + "supports": ["BANGLEJS", "BANGLEJS2"], + "readme": "README.md", + "storage": [{ "name": "widtwenties.wid.js", "url": "widget.js" }] +} diff --git a/apps/widtwenties/widget.js b/apps/widtwenties/widget.js new file mode 100644 index 000000000..b38f91d80 --- /dev/null +++ b/apps/widtwenties/widget.js @@ -0,0 +1,24 @@ +// WIDGETS = {}; // <-- for development only + +/* run widgets in their own function scope so +they don't interfere with currently-running apps */ +(() => { + const move = 20 * 60 * 1000; // 20 minutes + const look = 20 * 1000; // 20 seconds + + buzz = _ => { + Bangle.buzz().then(_ => { + setTimeout(Bangle.buzz, look); + }); + }; + + // add widget + WIDGETS.twenties = { + buzz: buzz, + draw: null, + }; + + setInterval(WIDGETS.twenties.buzz, move); // buzz to stand / sit +})(); + +// Bangle.drawWidgets(); // <-- for development only \ No newline at end of file diff --git a/apps/widtwenties/widget.png b/apps/widtwenties/widget.png new file mode 100644 index 000000000..7c6b02055 Binary files /dev/null and b/apps/widtwenties/widget.png differ