You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
666 B
33 lines
666 B
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) {
|
|
return new Promise((resolve, reject) => {
|
|
const address = normalizeAddress(_address)
|
|
this.store.updateState({ selectedAddress: address })
|
|
resolve()
|
|
})
|
|
}
|
|
|
|
getSelectedAddress(_address) {
|
|
return this.store.getState().selectedAddress
|
|
}
|
|
|
|
//
|
|
// PRIVATE METHODS
|
|
//
|
|
|
|
}
|
|
|
|
module.exports = PreferencesController
|
|
|