Skip to content

Commit 4c78076

Browse files
committed
Allow custom modules for apps
1 parent 6a63a6e commit 4c78076

4 files changed

Lines changed: 25 additions & 1 deletion

File tree

‎README.md‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,18 @@ It should also add `app.json` to `data`, to make sure it is cleaned up when the
394394
},
395395
```
396396

397+
## Modules
398+
399+
You can include any of [Espruino's modules](https://www.espruino.com/Modules) as
400+
normal with `require("modulename")`. If you want to develop your own module for your
401+
app(s) then you can do that too. Just add the module into the `modules` folder
402+
then you can use it from your app as normal.
403+
404+
You won't be able to develop apps using your own modules with the IDE,
405+
so instead we'd recommend you write your module to a Storage File called
406+
`modulename` on Bangle.js. You can then develop your app as normal on Bangle.js
407+
from the IDE.
408+
397409
## Coding hints
398410

399411
- use `g.setFont(.., size)` to multiply the font size, eg ("6x8",3) : "18x24"

‎core‎

Submodule core updated 1 file

‎modules/README.md‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
App Modules
2+
===========
3+
4+
These are modules used by apps - you can use them with:
5+
6+
```
7+
var testmodule = require("testmodule");
8+
testmodule.test()
9+
```

‎modules/testmodule.js‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
exports.test = function() {
2+
console.log("Hello world!");
3+
};

0 commit comments

Comments
 (0)