aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/lib
diff options
context:
space:
mode:
authorkumavis <aaron@kumavis.me>2017-01-31 04:42:24 +0800
committerkumavis <aaron@kumavis.me>2017-01-31 04:42:24 +0800
commit0a1918f71a0a5768d7501e3ee799a3ed2e6d9f49 (patch)
tree3056594a3003b8e499950de3f719f62d4cf013ec /app/scripts/lib
parentb6909574a7036c396ed85809cbd90aa2171b012f (diff)
downloadtangerine-wallet-browser-0a1918f71a0a5768d7501e3ee799a3ed2e6d9f49.tar
tangerine-wallet-browser-0a1918f71a0a5768d7501e3ee799a3ed2e6d9f49.tar.gz
tangerine-wallet-browser-0a1918f71a0a5768d7501e3ee799a3ed2e6d9f49.tar.bz2
tangerine-wallet-browser-0a1918f71a0a5768d7501e3ee799a3ed2e6d9f49.tar.lz
tangerine-wallet-browser-0a1918f71a0a5768d7501e3ee799a3ed2e6d9f49.tar.xz
tangerine-wallet-browser-0a1918f71a0a5768d7501e3ee799a3ed2e6d9f49.tar.zst
tangerine-wallet-browser-0a1918f71a0a5768d7501e3ee799a3ed2e6d9f49.zip
preferences - introduce preferences controller
Diffstat (limited to 'app/scripts/lib')
-rw-r--r--app/scripts/lib/controllers/preferences.js30
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