Skip to content

Commit

Permalink
remove Settings module
Browse files Browse the repository at this point in the history
Better not to have this at all than to have a library that you can't
actually use in widgets/boot/settings code
  • Loading branch information
rigrig committed Dec 1, 2021
1 parent 7218acf commit 3baa465
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 105 deletions.
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -384,14 +384,18 @@ Example `settings.js`
```js
// make sure to enclose the function in parentheses
(function(back) {
function get(key, def) { return require('Settings').get('myappid', key, def); }
function set(key, value) { require('Settings').set('myappid', key, value); }
let settings = require('Storage').readJSON('myappid.json',1)||{};
if (typeof settings.monkeys !== "number") settings.monkeys = 12; // default value
function save(key, value) {
settings[key] = value;
require('Storage').write('myappid.json', settings);
}
const appMenu = {
'': {'title': 'App Settings'},
'< Back': back,
'Monkeys': {
value: get('monkeys', 12),
onchange: (m) => set('monkeys', m)
value: settings.monkeys,
onchange: (m) => {save('monkeys', m)}
}
};
E.showMenu(appMenu)
Expand Down
101 changes: 0 additions & 101 deletions modules/Settings.js

This file was deleted.

0 comments on commit 3baa465

Please sign in to comment.