I was thinking about adding simple Settings library, just something like require('Settings').get('app.settings.json', 'option.to.get', 'default'); and require('Settings').set('app.settings.json', 'option.to.set', 'value');
Probably wouldn't be much work to implement, but we could get rid of (almost?) all of the defaults-handling boilerplate in apps.
Does this seem like a good idea, or would it add too much overhead for apps? (I think it would be ok, as they are already loading+parsing a settings file anyway)
Having a separate library just for two functions feels a bit cluttery, maybe a "Core/Standard/Basic/Bikeshed" library with getSetting/setSetting would be better? (I can't really think of similar functions right now, but going through all apps to change it later would be a shame.)
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
I was thinking about adding simple
Settings
library, just something likerequire('Settings').get('app.settings.json', 'option.to.get', 'default');
andrequire('Settings').set('app.settings.json', 'option.to.set', 'value');
Probably wouldn't be much work to implement, but we could get rid of (almost?) all of the defaults-handling boilerplate in apps.
getSetting
/setSetting
would be better? (I can't really think of similar functions right now, but going through all apps to change it later would be a shame.)