Uploading code that contains library requirement #7007
Replies: 1 comment
-
Posted at 2024-09-17 by @gfwilliams Ahh - yes, you have a few options:
Posted at 2024-09-17 by JackHack96 Ok so I've tried the first workaround, in which I created a file that just contains
saved as 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:
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 Posted at 2024-09-17 by @fanoush
That is not how it was meant. You created a loop and you are lucky the universe did not explode :-) The Layout file in storage is the one that gets loaded when code Posted at 2024-09-17 by @fanoush So I guess you could upload EDIT: Looks like it is actually described as an option here https://github.com/espruino/BangleApps/tree/master/modules#upload-the-module-to-the-bangles-internal-storage Posted at 2024-09-17 by JackHack96
Whoops, yeah it's like chained Ok now just uploading the Thanks for the patience! Posted at 2024-09-18 by @gfwilliams Glad you got it sorted!
Just so you know, what I meant was to run the If you really want to embed the layout script in the file, you can add this to the front of your file:
It's what the IDE does automatically for you |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2024-09-17 by JackHack96
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.JS
write()
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?
Attachments:
Beta Was this translation helpful? Give feedback.
All reactions