diff options
author | frankiebee <frankie.diamond@gmail.com> | 2017-09-13 00:59:59 +0800 |
---|---|---|
committer | frankiebee <frankie.diamond@gmail.com> | 2017-09-13 00:59:59 +0800 |
commit | 3ad67d1b14b5b56002cf34ab6dbb18d602705827 (patch) | |
tree | 14226bfb3d9705b9a79c428dbaa251c9a3cfc313 /app/scripts/lib/tx-state-manager.js | |
parent | 62f26c5ba873280b536aa7ce31cf92733a3e707c (diff) | |
download | tangerine-wallet-browser-3ad67d1b14b5b56002cf34ab6dbb18d602705827.tar tangerine-wallet-browser-3ad67d1b14b5b56002cf34ab6dbb18d602705827.tar.gz tangerine-wallet-browser-3ad67d1b14b5b56002cf34ab6dbb18d602705827.tar.bz2 tangerine-wallet-browser-3ad67d1b14b5b56002cf34ab6dbb18d602705827.tar.lz tangerine-wallet-browser-3ad67d1b14b5b56002cf34ab6dbb18d602705827.tar.xz tangerine-wallet-browser-3ad67d1b14b5b56002cf34ab6dbb18d602705827.tar.zst tangerine-wallet-browser-3ad67d1b14b5b56002cf34ab6dbb18d602705827.zip |
match other controller patterns
Diffstat (limited to 'app/scripts/lib/tx-state-manager.js')
-rw-r--r-- | app/scripts/lib/tx-state-manager.js | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/app/scripts/lib/tx-state-manager.js b/app/scripts/lib/tx-state-manager.js index 661523f10..843592504 100644 --- a/app/scripts/lib/tx-state-manager.js +++ b/app/scripts/lib/tx-state-manager.js @@ -1,10 +1,16 @@ const extend = require('xtend') +const EventEmitter = require('events') const ObservableStore = require('obs-store') const txStateHistoryHelper = require('./tx-state-history-helper') -module.exports = class TransactionStateManger extends ObservableStore { +module.exports = class TransactionStateManger extends EventEmitter { constructor ({initState, txHistoryLimit, getNetwork}) { - super(initState) + super() + + this.store = new ObservableStore( + extend({ + transactions: [], + }, initState)) this.txHistoryLimit = txHistoryLimit this.getNetwork = getNetwork } @@ -20,7 +26,7 @@ module.exports = class TransactionStateManger extends ObservableStore { } getFullTxList () { - return this.getState().transactions + return this.store.getState().transactions } // Returns the tx list @@ -196,10 +202,9 @@ module.exports = class TransactionStateManger extends ObservableStore { this._setTxStatus(txId, 'failed') } -/* _____________________________________ -| | -| PRIVATE METHODS | -|______________________________________*/ +// +// PRIVATE METHODS +// // Should find the tx in the tx list and // update it. @@ -225,6 +230,6 @@ module.exports = class TransactionStateManger extends ObservableStore { // Saves the new/updated txList. // Function is intended only for internal use _saveTxList (transactions) { - this.updateState({ transactions }) + this.store.updateState({ transactions }) } }
\ No newline at end of file |