Skip to content

Commit

Permalink
Allow custom modules for apps
Browse files Browse the repository at this point in the history
  • Loading branch information
gfwilliams committed Dec 9, 2020
1 parent 6a63a6e commit 4c78076
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 1 deletion.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,18 @@ It should also add `app.json` to `data`, to make sure it is cleaned up when the
},
```

## Modules

You can include any of [Espruino's modules](https://www.espruino.com/Modules) as
normal with `require("modulename")`. If you want to develop your own module for your
app(s) then you can do that too. Just add the module into the `modules` folder
then you can use it from your app as normal.

You won't be able to develop apps using your own modules with the IDE,
so instead we'd recommend you write your module to a Storage File called
`modulename` on Bangle.js. You can then develop your app as normal on Bangle.js
from the IDE.

## Coding hints

- use `g.setFont(.., size)` to multiply the font size, eg ("6x8",3) : "18x24"
Expand Down
2 changes: 1 addition & 1 deletion core
Submodule core updated 1 files
+4 −1 js/appinfo.js
9 changes: 9 additions & 0 deletions modules/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
App Modules
===========

These are modules used by apps - you can use them with:

```
var testmodule = require("testmodule");
testmodule.test()
```
3 changes: 3 additions & 0 deletions modules/testmodule.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
exports.test = function() {
console.log("Hello world!");
};

0 comments on commit 4c78076

Please sign in to comment.