diff options
preferences - introduce preferences controller
Diffstat (limited to 'app/scripts/lib')
-rw-r--r-- | app/scripts/lib/controllers/preferences.js | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/app/scripts/lib/controllers/preferences.js b/app/scripts/lib/controllers/preferences.js new file mode 100644 index 000000000..e338f5b5e --- /dev/null +++ b/app/scripts/lib/controllers/preferences.js @@ -0,0 +1,30 @@ +const ObservableStore = require('obs-store') +const normalizeAddress = require('../sig-util').normalize + +class PreferencesController { + + constructor (opts = {}) { + const initState = opts.initState || {} + this.store = new ObservableStore(initState) + } + + // + // PUBLIC METHODS + // + + setSelectedAddress(_address) { + const address = normalizeAddress(_address) + this.store.updateState({ selectedAddress: address }) + } + + getSelectedAddress(_address) { + return this.store.getState().selectedAddress + } + + // + // PRIVATE METHODS + // + +} + +module.exports = PreferencesController |