Thanks for the quick reply - it sounds good but I can't get the module to work. Uploading the module to storage gave Uncaught ReferenceError: "exports" is not defined at line 4 col 8 in widget_utils followed by Module widget_utils not found when I ran it (and also when I changed the IDE search path ).
But if I try require("wear_detect").isWorn().then(worn => {
console.log(worn ? "is worn" : "not worn");
}); it works correctly.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Thanks for the quick reply - it sounds good but I can't get the module to work. Uploading the module to storage gave Uncaught ReferenceError: "exports" is not defined at line 4 col 8 in widget_utils followed by Module widget_utils not found when I ran it (and also when I changed the IDE search path ).
But if I try require("wear_detect").isWorn().then(worn => {
console.log(worn ? "is worn" : "not worn");
}); it works correctly.
I must be missing something!