Testing withweb IDE emulator

Posted on
  • Hi
    Just getting started on a new app and I wanted to try things out on the emulator before I do anything with the watch, this is the way I have played with a lot of other peoples code on here and I really like that I can do that with this IDE.
    That said I have a part of my current project that asks the bangle if it is charging (just simple Bangle.isCharging() ) and that course the emulator to fail.
    As this is not an important value for the app I am doing, I was wondering if there was a way to set values for things like this when in the emulator?
    I mean is there a way to check if the code is being run in an emulator and as such be able to suply value to get it to run?

  • Ignore me, I worked it out sorry

  • Yes, sure! You can do:

    if (process.env.BOARD=="EMSCRIPTEN") {
     ...
    }
    

    You could even set certain values in there, for example Bangle.isCharging = ()=>false;

    just simple Bangle.isCharging() ... and that course the emulator to fail.

    That's odd - just tried it here and it seems to work fine?

  • Just while I have brought it up is there a way to set values for the bangle on the emulator? I.e. if I wanted it to seem like the bangle was not charging etc?

  • Sorry you answered that above

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Testing withweb IDE emulator

Posted by Avatar for DrBard @DrBard

Actions