• Hi all,

    Just got a Bangle.js 2, been spending some time playing around with some apps, and looking forward to eventually seeing what kind of hacking I can do on it. :)

    But right now, I cannot for the life of me figure out how to test apps in the emulator. The only docs I can find seem to make it sound as simple as clicking the emulator button for that app in the App Loader, but… evidently not. I click the button, my browser opens the Espruino IDE with an emulator window, but I can't get anything to happen. The emulator window just shows a splash screen, I click and drag every conceivable button and part of the UI but cannot get anything to happen no matter which app I try to test.

    I can paste some little tutorial examples into the IDE and those run, but how on Earth do you load an app from the App Loader, view the code, and run that? All I get is a tab with a comment that says “Loading from ”, but no code and no response.

    Tried this on both Firefox and Chromium on Ubuntu 20.04 and had the same results. I suppose I could try to install Chrome and test that if I had to, but all the other features (including App Loader connection and transferring apps to my real watch) seem to work fine in Chromium.

    Anyone know what I'm missing? I've been up and down Google and every Espruino and tutorial I can find and nothing seems to explain how to actually get the “try in emulator” thing working in any kind of detail.

  • Hi, sorry about this. So the Web IDE right-hand side says something like // Loading from https://banglejs.com/apps/apps/clock2x3/clock2x3-app.js... ?

    After a few seconds that should be replaced with the contents of https://banglejs.com/apps/apps/clock2x3/clock2x3-app.js and that didn't happen which I think is why it's not working

    I've just pushed some changes so if you go to https://www.espruino.com/ide/ and then click refresh, then try clicking the emulator button again in the app loader it should be fine.

  • Thanks! Yes, that's what was happening. I did a force-reload on both browsers and now it's working.

    Is there a simpler way to get apps into the emulator which don't have an emulator button in the loader? Unfortunately, one of the first apps I wanted to tinker with seemed to turn out being one of the more complex ones out there (unbeknownst to me at first). It took a while, but I eventually worked out how to manually load each of the app's files into storage with the proper name prefixes, but then it used a module and I had to figure out exactly where that should be stored. To be fair, that turned out being in the documentation somewhere, but for some reason I had some trouble finding the correct info with Google, so it was a little frustrating. In the end, I got it working, though to reload the app I had to use a manual command in the debugger window as it gets stuck on a “Loading…” screen with no error messages if it tries to reload itself—haven't worked that part out just yet. Maybe something to do with the emulator defaulting to not having any of the usual apps installed that the physical Bangle.js ships with?

    Anyway, it makes me wonder if I'm missing something more obvious, as this workflow seems a bit more clumsy and long-winded than I was expecting. On the upside, I think in the process I'm starting to get a better context of how the Bangle.js system and apps are structured, so that should help. :)

  • Is there a simpler way to get apps into the emulator which don't have an emulator button in the loader?

    If you click the little GitHub icon next to an app in https://banglejs.com/apps/ it'll bring you to the GitHub page where that app's files are, and you can then open that file and copy/paste in the IDE.

    However sometimes if an app isn't in the emulator it's because it's a multi-file application or depends on some other application. While it should be possible to load those into the emulator from the App Loader that's not something that's been done yet.

    Since you have a Bangle, I'd say try developing on the Bangle itself - it's a lot easier and there are a lot of safeguards to stop you 'bricking' it :)

    In that case:

    • in the App Loader, make sure "Pretokenise apps" isn't enabled. Upload/re-upload the app you're interested in.
    • Then go to https://www.espruino.com/ide/ and connect (top left, web bluetooth, your device)
    • click on the storage icon in the middle of the screen (looks like a hamburger)
    • Find your app - this is your app's ID (it's in the github link) followed by .app.js usually
    • Click the Eye icon next to it
    • In the window showing the code, scroll down and click 'copy to editor'
    • Click the down-arrow next to the 'upload' icon (below the Storage one), choose Storage and choose the app's file from the list again (I guess this should be automatic really)
    • Now if you click the upload icon again (not the down-arrow) it'll upload the file from the editor and will run it (but with all the other stuff that was installed for that app as well)

  • I see. Since most apps don't have that many files, I guess it's not that bad yet.

    I have noticed in many cases it does seem simpler to just directly modify an app file on the physical Bangle's storage, especially when I just want to do some longer-term testing of a small tweak in a larger app (and that change may involve a library file that's not meant to be run directly from RAM anyway).

    It would indeed be nice if the IDE remembered the source of the file I selected so that it could be written back to its source without having to manually locate and reselect the destination in the list. That would also reduce the chance of accidentally overwriting the wrong file on the device by clicking the wrong name.

    It would also be more ideal to have the buttons like “Copy to code editor” accessible immediately without having to scroll all the way to the bottom of the file first to reach them.

    Update: By the way, I worked out getting my own personal App Loader fork on Github and testing and pushing experimental changes to apps to my watch from there. It looks like I can do the same with the IDE too if I ever want to tinker with the code. Anyway, just posted my first small PR for BangleApps. :)

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

Trouble with “try in emulator” button in App Loader

Posted by Avatar for tev @tev

Actions