2022-09-08 09:40:03 +00:00
|
|
|
/** Returns a promise that resolves with whether the Bangle
|
|
|
|
is worn or not.
|
|
|
|
|
|
|
|
Usage:
|
|
|
|
|
|
|
|
require("wear_detect").isWorn().then(worn => {
|
|
|
|
console.log(worn ? "is worn" : "not worn");
|
|
|
|
});
|
|
|
|
*/
|
|
|
|
exports.isWorn = function() {
|
|
|
|
return new Promise(resolve => {
|
|
|
|
if (Bangle.isCharging())
|
|
|
|
return resolve(false);
|
2022-09-10 00:54:08 +00:00
|
|
|
if (Bangle.getHealthStatus().movement > 124)
|
2022-09-08 09:40:03 +00:00
|
|
|
return resolve(true);
|
|
|
|
return resolve(false);
|
|
|
|
});
|
|
|
|
};
|