Commit Graph

3 Commits (32dc0d6d7fdb380402c53372c67a90038f92191a)

Author SHA1 Message Date
Richard de Boer 39621bfae0 Settings: Add support for app/widget settings
Apps and widgets can add a `<appid>.settings.js` file which can be
opened from the "App/widget settings" submenu.
This file should define a single function to configure the app/widget.
The function is passed a `back` argument, which can be used to return to
the settings menu by calling `back()`.

Example `<appid>.settings.js`:
```
function settings(back) {
  const mySettingsMenu = {
    '': { 'title': 'My Widget' },
    '< Back': back, // go back to settings menu
    'Sound': {
      value: false,
      format: s => s ? 'on' : 'off',
      onchange: s => {if(s) Bangle.beep()} // TODO: save new value
    },
  };
  E.showMenu(mySettingsMenu)
}
```
2020-04-03 01:46:43 +02:00
Gordon Williams 04f8cbcd13 write code in chunks, in case it is too big to fit in RAM (fix #157) 2020-03-31 13:37:03 +01:00
Gordon Williams b40c9031e1 refactor - move JS into its own directory 2020-03-31 13:18:31 +01:00