Initial BangleJS Development questions

Posted on
  • Hi there,

    So my BangleJS arrived today after an adventure in stuck in Dutch customs (yay B*exit) for over a week and then sent to a depot 40min drive away from me!

    I've had a good play with it already today and had a few questions - I've been working on my Moods app and some things have come up already.

    • Is there a way to add a custom "standard library" - for example, I figured out that the maximum number of characters per line is 20, with 4 lines so I've written a custom function I'd like to potentially re-use, but certainly removed from the main JS file of my app (also some preferred date functions - I tried moving it to a file to require in my project but this didn't seem to work

    • With the above I discovered the best ratio of characters/screen - is there more info like this such as best-practices for UI and UX design for the watch? Is there any concept of scrolling on the device?

    • Are there any details on what version of ECMAScript is the closest? For example, I see the device has support for const/let and has TypedArrays, but no support for deestructuring or default values? Has anyone set up any toolchains to allow compiling from higher-level code?

  • Hi! Sorry to hear about the customs issues - hopefully this will all go pretty much back to normal come July (and the new EU VAT rules).

    Is there a way to add a custom "standard library"

    Yes - it's worth checking out https://www.espruino.com/Modules#from-gi­thub-or-anywhere-on-the-internet-

    You can have the module online, or can just write the module direct to the Bangle's Storage.

    is there more info like this such as best-practices for UI and UX design for the watch?

    Not specifically but if you haven't already it's worth checking out the example app/widget tutorials: https://www.espruino.com/Bangle.js#tutor­ials

    There are also some hints about how to write reasonably efficient code: https://www.espruino.com/Bangle.js+Guide­lines

    Is there any concept of scrolling on the device?

    Yes - you can scroll vertically with g.scroll(0, ...) but that's the whole screen - so you can't scroll if you have widgets. You can always write your data to an offscreen buffer, scroll that, and then write it to the screen.

    Are there any details on what version of ECMAScript is the closest?

    https://www.espruino.com/Features

    Has anyone set up any toolchains to allow compiling from higher-level code?

    If you do a quick search there are a few node.js modules to transpile. BangleRun for instance is written in TypeScript: https://github.com/espruino/BangleApps/t­ree/master/apps/banglerun

    However it does make debugging more difficult (eg trying to track back stack traces) and may result in a bunch of polyfill code being added. Personally I'd start off just trying to write the JS that Espruino supports and see where that takes you before you try transpiling.

  • Brilliant stuff! This really helps get a deeper understanding of what's available and not - and love the remote modules! That'll really help to just throw some code on Github and use it as my own standard lib stuff.

    Regarding scrolling, I suppose I mean more scrollbars, but since it's not really touch scrolling but button event-based I suppose I can just re-render the message using something similar to the page technique I have.

    Thanks for your help

  • Ahh - yes, there's no scrollbar support or anything line that - the touchscreen is only 2 area so it doesn't make much sense. If in future we do a touch device then something like that would make a lot of sense though

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

Initial BangleJS Development questions

Posted by Avatar for tanepiper @tanepiper

Actions