JackHack96
Member since Sep 2024 • Last active Sep 2024Most recent activity
-
Ok so I've tried the first workaround, in which I created a file that just contains
const Layout = require("Layout");
saved as
Layout
in the Bangle.But then even if the `const Layout = require("Layout") from my script seems to get executed, the interpreter raises an error when actually trying to build the Layout:
Uncaught Error: Constructor should be a function, but is Object at line 1 col 18 let layout = new Layout({
I'm a newbie in JavaScript, but I think that this means the import didn't actually work.
I was tempted by the usage of the
espruino
tool but I'd like to keep the web page self-contained without depending on a Node.js installation.
Maybe it's possible to upload a file (thus a script) and "execute" from the console? I'm guessing how the IDE does that... -
Hello!
I'm developing a standalone web page that shows the data of the sensors of the BangleJS 2 plus some beacons. This page contains a JavaScript code that uploads the code on-the-fly using Puck.JSwrite()
function, which I think is like writing to the console in the Web IDE, as showed in the https://www.espruino.com/Bangle.js+Data+Streaming tutorialThe problem is that the code I use on the Bangle uses the Layout library. If I try to run the code using the Web IDE, everything works ok, but if I try to run the same code by uploading it it fails on the
require("Layout")
statement. The same happens if I use the REPL console of the Web IDE.Is there a way to fix this?
Whoops, yeah it's like chained
#include
in C/C++Ok now just uploading the
Layout.min.js
solved the issue and the program works as intended. Now the only thing that remains to try is to find a way to automatically upload the file to a BangleJS (or embedding the Layout library in the script, even if it's kind of ugly).Thanks for the patience!
Best regards