aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorkumavis <aaron@kumavis.me>2018-05-17 12:10:41 +0800
committerkumavis <aaron@kumavis.me>2018-05-17 12:10:41 +0800
commit3e04840a7104849e9329b8faa4730554b2438217 (patch)
tree3cf487318062c6be814b9982f83427f66b0069e3 /app
parentb6eff15bd25ca30ba8a746eff2beec1c820b8855 (diff)
downloadtangerine-wallet-browser-3e04840a7104849e9329b8faa4730554b2438217.tar
tangerine-wallet-browser-3e04840a7104849e9329b8faa4730554b2438217.tar.gz
tangerine-wallet-browser-3e04840a7104849e9329b8faa4730554b2438217.tar.bz2
tangerine-wallet-browser-3e04840a7104849e9329b8faa4730554b2438217.tar.lz
tangerine-wallet-browser-3e04840a7104849e9329b8faa4730554b2438217.tar.xz
tangerine-wallet-browser-3e04840a7104849e9329b8faa4730554b2438217.tar.zst
tangerine-wallet-browser-3e04840a7104849e9329b8faa4730554b2438217.zip
remove unused events-proxy, was replaced with module swappable-obj-proxy
Diffstat (limited to 'app')
-rw-r--r--app/scripts/controllers/network/network.js1
-rw-r--r--app/scripts/lib/events-proxy.js42
2 files changed, 0 insertions, 43 deletions
diff --git a/app/scripts/controllers/network/network.js b/app/scripts/controllers/network/network.js
index a8c45a79c..213013cca 100644
--- a/app/scripts/controllers/network/network.js
+++ b/app/scripts/controllers/network/network.js
@@ -10,7 +10,6 @@ const createMetamaskMiddleware = require('./createMetamaskMiddleware')
const createInfuraClient = require('./createInfuraClient')
const createJsonRpcClient = require('./createJsonRpcClient')
const createLocalhostClient = require('./createLocalhostClient')
-// const createEventEmitterProxy = require('../../lib/events-proxy.js')
const { createSwappableProxy, createEventEmitterProxy } = require('swappable-obj-proxy')
const {
diff --git a/app/scripts/lib/events-proxy.js b/app/scripts/lib/events-proxy.js
deleted file mode 100644
index f83773ccc..000000000
--- a/app/scripts/lib/events-proxy.js
+++ /dev/null
@@ -1,42 +0,0 @@
-/**
- * Returns an EventEmitter that proxies events from the given event emitter
- * @param {any} eventEmitter
- * @param {object} listeners - The listeners to proxy to
- * @returns {any}
- */
-module.exports = function createEventEmitterProxy (eventEmitter, listeners) {
- let target = eventEmitter
- const eventHandlers = listeners || {}
- const proxy = /** @type {any} */ (new Proxy({}, {
- get: (_, name) => {
- // intercept listeners
- if (name === 'on') return addListener
- if (name === 'setTarget') return setTarget
- if (name === 'proxyEventHandlers') return eventHandlers
- return (/** @type {any} */ (target))[name]
- },
- set: (_, name, value) => {
- target[name] = value
- return true
- },
- }))
- function setTarget (/** @type {EventEmitter} */ eventEmitter) {
- target = eventEmitter
- // migrate listeners
- Object.keys(eventHandlers).forEach((name) => {
- /** @type {Array<Function>} */ (eventHandlers[name]).forEach((handler) => target.on(name, handler))
- })
- }
- /**
- * Attaches a function to be called whenever the specified event is emitted
- * @param {string} name
- * @param {Function} handler
- */
- function addListener (name, handler) {
- if (!eventHandlers[name]) eventHandlers[name] = []
- eventHandlers[name].push(handler)
- target.on(name, handler)
- }
- if (listeners) proxy.setTarget(eventEmitter)
- return proxy
-}