|
1 | 1 | App Modules
|
2 | 2 | ===========
|
3 | 3 |
|
4 |
| -These are modules used by apps - you can use them with: |
| 4 | +These are modules used by apps - you can use them from a Bangle.js app with: |
5 | 5 |
|
6 | 6 | ```
|
7 | 7 | var testmodule = require("testmodule");
|
8 | 8 | testmodule.test()
|
9 | 9 | ```
|
| 10 | + |
| 11 | +Development |
| 12 | +----------- |
| 13 | + |
| 14 | +When apps that use these modules are uploaded via the |
| 15 | +app loader, the module is automatically included in the app's source. However |
| 16 | +when developing via the IDE the module won't get pulled in by default. |
| 17 | + |
| 18 | +To fix this you have three options: |
| 19 | + |
| 20 | +### Host your own App Loader and upload from that |
| 21 | + |
| 22 | +This is reasonably easy to set up, but it's more difficult to make changes and upload: |
| 23 | + |
| 24 | +* Follow the steps here to set up your own App Loader: https://www.espruino.com/Bangle.js+App+Loader |
| 25 | +* Make changes to that repository |
| 26 | +* Refresh and upload your app from the app loader (you can have the IDE connected |
| 27 | + at the same time so you can see any error messages) |
| 28 | + |
| 29 | +### Upload the module to the Bangle's internal storage |
| 30 | + |
| 31 | +This allows you to develop both the app and module very quickly, but the app is |
| 32 | +uploaded in a slightly different way to what you'd get when you use the App Loader |
| 33 | +or the method below: |
| 34 | + |
| 35 | +* Load the module's source file in the Web IDE |
| 36 | +* Click the down-arrow below the upload button, then `Storage` |
| 37 | +* Click `New File`, type `your_module_name` as the name (with no `.js` extension), click `Ok` |
| 38 | +* Now Click the `Upload` icon. |
| 39 | + |
| 40 | +You can now upload the app direct from the IDE. You can even leave a second Web IDE window open |
| 41 | +(one for the app, one for the module) to allow you to change the module. |
| 42 | + |
| 43 | +### Change the Web IDE search path to include Bangle.js modules |
| 44 | + |
| 45 | +This is nice and easy (and the results are the same as if the app was |
| 46 | +uploaded via the app loader), however you cannot then make/test changes |
| 47 | +to the module. |
| 48 | + |
| 49 | +* In the IDE, Click the `Settings` icon in the top right |
| 50 | +* Click `Communications` and scroll down to `Module URL` |
| 51 | +* Now change the module URL from the default of `https://www.espruino.com/modules` |
| 52 | +to `https://banglejs.com/apps/modules|https://www.espruino.com/modules` |
| 53 | + |
| 54 | +The next time you upload your app, the module will automatically be included. |
0 commit comments