diff options
author | Frankie <frankie.diamond@gmail.com> | 2017-01-06 03:06:18 +0800 |
---|---|---|
committer | Frankie <frankie.diamond@gmail.com> | 2017-01-06 03:06:18 +0800 |
commit | e62f70660d922b0bf98e7595939f84821eff814a (patch) | |
tree | c36841a2976483a239b99b19815e55101f1a827a /app/scripts/background.js | |
parent | c22da8450cf5014fb2bf3c96e0df88c70aa39465 (diff) | |
download | tangerine-wallet-browser-e62f70660d922b0bf98e7595939f84821eff814a.tar tangerine-wallet-browser-e62f70660d922b0bf98e7595939f84821eff814a.tar.gz tangerine-wallet-browser-e62f70660d922b0bf98e7595939f84821eff814a.tar.bz2 tangerine-wallet-browser-e62f70660d922b0bf98e7595939f84821eff814a.tar.lz tangerine-wallet-browser-e62f70660d922b0bf98e7595939f84821eff814a.tar.xz tangerine-wallet-browser-e62f70660d922b0bf98e7595939f84821eff814a.tar.zst tangerine-wallet-browser-e62f70660d922b0bf98e7595939f84821eff814a.zip |
MetaMask Controller - Convert to EventEmitter
Diffstat (limited to 'app/scripts/background.js')
-rw-r--r-- | app/scripts/background.js | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/app/scripts/background.js b/app/scripts/background.js index ca2efc114..6b7926526 100644 --- a/app/scripts/background.js +++ b/app/scripts/background.js @@ -22,7 +22,6 @@ const controller = new MetamaskController({ setData, loadData, }) -const keyringController = controller.keyringController const txManager = controller.txManager function triggerUi () { if (!popupIsOpen) notification.show() @@ -81,13 +80,11 @@ function setupControllerConnection (stream) { stream.pipe(dnode).pipe(stream) dnode.on('remote', (remote) => { // push updates to popup - controller.ethStore.on('update', controller.sendUpdate.bind(controller)) - controller.listeners.push(remote) - keyringController.on('update', controller.sendUpdate.bind(controller)) - + var sendUpdate = remote.sendUpdate.bind(remote) + controller.on('update', sendUpdate) // teardown on disconnect eos(stream, () => { - controller.ethStore.removeListener('update', controller.sendUpdate.bind(controller)) + controller.removeListener('update', sendUpdate) popupIsOpen = false }) }) |