From 08e168ab629d642accbe62a7005c5b01863327e0 Mon Sep 17 00:00:00 2001 From: Gordon Williams Date: Fri, 28 Jan 2022 09:46:19 +0000 Subject: [PATCH] docs on modules --- modules/Layout.js | 3 +++ modules/README.md | 47 ++++++++++++++++++++++++++++++++++++++++++- modules/dane_arwes.js | 2 ++ 3 files changed, 51 insertions(+), 1 deletion(-) diff --git a/modules/Layout.js b/modules/Layout.js index cb64183ea..fbd618524 100644 --- a/modules/Layout.js +++ b/modules/Layout.js @@ -1,5 +1,8 @@ +/* Copyright (c) 2022 Bangle.js contibutors. See the file LICENSE for copying permission. */ /* +Take a look at README.md for hints on developing with this library. + Usage: ``` diff --git a/modules/README.md b/modules/README.md index 6930da2b9..62ce90a97 100644 --- a/modules/README.md +++ b/modules/README.md @@ -1,9 +1,54 @@ App Modules =========== -These are modules used by apps - you can use them with: +These are modules used by apps - you can use them from a Bangle.js app with: ``` var testmodule = require("testmodule"); testmodule.test() ``` + +Development +----------- + +When apps that use these modules are uploaded via the +app loader, the module is automatically included in the app's source. However +when developing via the IDE the module won't get pulled in by default. + +To fix this you have three options: + +### Host your own App Loader and upload from that + +This is reasonably easy to set up, but it's more difficult to make changes and upload: + +* Follow the steps here to set up your own App Loader: https://www.espruino.com/Bangle.js+App+Loader +* Make changes to that repository +* Refresh and upload your app from the app loader (you can have the IDE connected + at the same time so you can see any error messages) + +### Upload the module to the Bangle's internal storage + +This allows you to develop both the app and module very quickly, but the app is +uploaded in a slightly different way to what you'd get when you use the App Loader +or the method below: + +* Load the module's source file in the Web IDE +* Click the down-arrow below the upload button, then `Storage` +* Click `New File`, type `your_module_name` as the name (with no `.js` extension), click `Ok` +* Now Click the `Upload` icon. + +You can now upload the app direct from the IDE. You can even leave a second Web IDE window open +(one for the app, one for the module) to allow you to change the module. + +### Change the Web IDE search path to include Bangle.js modules + +This is nice and easy (and the results are the same as if the app was +uploaded via the app loader), however you cannot then make/test changes +to the module. + +* In the IDE, Click the `Settings` icon in the top right +* Click `Communications` and scroll down to `Module URL` +* Now change the module URL from the default of `https://www.espruino.com/modules` +to `https://banglejs.com/apps/modules|https://www.espruino.com/modules` + +The next time you upload your app, the module will automatically be included. diff --git a/modules/dane_arwes.js b/modules/dane_arwes.js index b24bc008e..0083d117b 100644 --- a/modules/dane_arwes.js +++ b/modules/dane_arwes.js @@ -1,6 +1,8 @@ /* Copyright (c) 2020 OmegaRogue. See the file LICENSE for copying permission. */ /* Graphics Functions based on the React Sci-Fi UI Framework Arwes + +Take a look at README.md for hints on developing with this library. */ var C = {