mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-24 02:58:09 +01:00
31 lines
593 B
JavaScript
31 lines
593 B
JavaScript
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
|