diff options
Diffstat (limited to 'app/scripts/lib/observable/index.js')
-rw-r--r-- | app/scripts/lib/observable/index.js | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/app/scripts/lib/observable/index.js b/app/scripts/lib/observable/index.js deleted file mode 100644 index 1ff112e95..000000000 --- a/app/scripts/lib/observable/index.js +++ /dev/null @@ -1,41 +0,0 @@ -const EventEmitter = require('events').EventEmitter - -class ObservableStore extends EventEmitter { - - constructor (initialState) { - super() - this._state = initialState - } - - // wrapper around internal get - get () { - return this._state - } - - // wrapper around internal put - put (newState) { - this._put(newState) - } - - // subscribe to changes - subscribe (handler) { - this.on('update', handler) - } - - // unsubscribe to changes - unsubscribe (handler) { - this.removeListener('update', handler) - } - - // - // private - // - - _put (newState) { - this._state = newState - this.emit('update', newState) - } - -} - -module.exports = ObservableStore |